Cos'è ElectroYou | Login Iscriviti

ElectroYou - la comunità dei professionisti del mondo elettrico

config word PIC 12F509

Raccolta di codici sorgenti

Moderatore: Foto UtentePaolino

0
voti

[11] Re: config word PIC 12F509

Messaggioda Foto Utenteramboluis » 21 mag 2013, 22:10

nel header che ho postato non trovo alcuna scritta cosi.saro scemo io :( . oppure ho capito male la domanda

comunque quello che ho posta io é 12F509.h
Avatar utente
Foto Utenteramboluis
80 1 7
Stabilizzato
Stabilizzato
 
Messaggi: 314
Iscritto il: 28 giu 2012, 18:39

0
voti

[12] Re: config word PIC 12F509

Messaggioda Foto Utentesimo85 » 21 mag 2013, 22:12

Scusa ho confuso

Codice: Seleziona tutto
#device PIC12F509


con

Codice: Seleziona tutto
#define PIC12F509


Chiedo venia. :oops:
Avatar utente
Foto Utentesimo85
30,9k 7 12 13
Disattivato su sua richiesta
 
Messaggi: 9927
Iscritto il: 30 ago 2010, 4:59

0
voti

[13] Re: config word PIC 12F509

Messaggioda Foto Utenteramboluis » 22 mag 2013, 16:24

mi trovo in un ulteriore problema
Codice: Seleziona tutto
FOSC_INTRC

funzionava perfettamente fino a ieri
da oggi quando vado a compilare mi da errore , ho fato varie prove e mi danno errore tutte le funzioni FOSC
nel datasheet a pagina 42 dice che possono essere impostati e seguenti FOSC
Codice: Seleziona tutto
FOSC_EXTRC
FOSC_INTRC
FOSC_XT
FOSC_LP

ma nessuna di queste costanti funziona. mi danno tutte errore
posto il codice come e strutturato ora:
Codice: Seleziona tutto
#ifndef _XTAL_FREQ
#define _XTAL_FREQ 4000000
#endif
#define  PIC_CLK 4000000
#include <PIC.h>





__CONFIG ( FOSC_INTRC & CP_OFF & MCLRE_OFF);

#include "delay.c"



void main(void)
{



TRIS=0b00000000;


while(1)
{
GP4=1;
GP2=1;
GP4=0;
GP2=0;


}

}


MPLAB V8.86 mi da il seguente errore:
Codice: Seleziona tutto
Executing: "C:\Program Files (x86)\HI-TECH Software\PICC\9.83\bin\picc.exe" --pass1 "C:\Users\PCPC\Desktop\cartelle varie\cose base PIC\main.c" -q --chip=12F509 -P --runtime=default --opt=default -D__DEBUG=1 -g --asmlist "--errformat=Error   [%n] %f; %l.%c %s" "--msgformat=Advisory[%n] %s" "--warnformat=Warning [%n] %f; %l.%c %s"
Executing: "C:\Program Files (x86)\HI-TECH Software\PICC\9.83\bin\picc.exe" -olaser.cof -mlaser.map --summary=default --output=default main.p1 --chip=12F509 -P --runtime=default --opt=default -D__DEBUG=1 -g --asmlist "--errformat=Error   [%n] %f; %l.%c %s" "--msgformat=Advisory[%n] %s" "--warnformat=Warning [%n] %f; %l.%c %s"
HI-TECH C Compiler for PIC10/12/16 MCUs (Lite Mode)  V9.83
Copyright (C) 2011 Microchip Technology Inc.
(1273) Omniscient Code Generation not available in Lite mode (warning)
Error   [800] laser.as; 44. undefined symbol "FOSC_INTRC"

********** Build failed! **********
Avatar utente
Foto Utenteramboluis
80 1 7
Stabilizzato
Stabilizzato
 
Messaggi: 314
Iscritto il: 28 giu 2012, 18:39

0
voti

[14] Re: config word PIC 12F509

Messaggioda Foto Utentesimo85 » 22 mag 2013, 16:34

Chi cerca trova. Hai cercato/analizzato più a fondo come ti ho detto io ieri?
Avatar utente
Foto Utentesimo85
30,9k 7 12 13
Disattivato su sua richiesta
 
Messaggi: 9927
Iscritto il: 30 ago 2010, 4:59

0
voti

[15] Re: config word PIC 12F509

Messaggioda Foto Utenteramboluis » 22 mag 2013, 16:46

ho trovato il file 12f509.dev che è quello che trovo scrivendo #device pic12f509
Codice: Seleziona tutto
######################################################################
#
# MPLAB IDE .dev File Generated by `pic2dev.py'
#
# Device: PIC12F509
# Family: 16c5x
# Datasheet: 41236
# Date: Mon Jun 11 05:31:34 2012
#
######################################################################


######################################################################
#
# Memory Regions & Other General Device Information
#
######################################################################

vpp (range=10.000-12.000 dflt=11.000)
vdd (range=2.500-5.500 dfltrange=3.000-5.500 nominal=5.000)
pgming (memtech=ee tries=1 lvpthresh=0)
    wait (pgm=3000 eedata=2000 cfg=2000 userid=2000 erase=10000 lvpgm=2000)
    latches (pgm=1 eedata=1 cfg=1 userid=1)
EraseAlg=1
HWStackDepth=2
breakpoints (numhwbp=1 datacapture=false idbyte=x)
calmem (region=0x3ff-0x3ff)
testmem (region=0x400-0x43f)
userid (region=0x400-0x403)
cfgmem (region=0xfff-0xfff)
pgmmem (region=0x0-0x3ff)
NumBanks=2
MirrorRegs (0x0-0x6 0x20-0x26)
MirrorRegs (0x7-0xf 0x27-0x2f)

######################################################################
#
# Special Function Registers
#
######################################################################

sfr (key=INDF addr=0x0 size=1 flags=i access='u u u u u u u u')
    reset (por='--------' mclr='--------')
    bit (names='INDF' width='8')
sfr (key=TMR0 addr=0x1 size=1 access='rw rw rw rw rw rw rw rw')
    reset (por='xxxxxxxx' mclr='uuuuuuuu')
    bit (names='TMR0' width='8')
    stimulus (scl=rwb pcfiles=w regfiles=w type=int)
sfr (key=PCL addr=0x2 size=1 access='rw rw rw rw rw rw rw rw')
    reset (por='11111111' mclr='11111111')
    bit (names='PCL' width='8')
    stimulus (scl=rwb pcfiles=rw regfiles=w)
sfr (key=STATUS addr=0x3 size=1 access='rw u rw r r rw rw rw')
    reset (por='0-011xxx' mclr='q-0qquuu')
    bit (names='GPWUF - PA0 nTO nPD Z DC C' width='1 1 1 1 1 1 1 1')
sfr (key=FSR addr=0x4 size=1 access='r r rw rw rw rw rw rw')
    reset (por='110xxxxx' mclr='110uuuuu')
    bit (names='FSR' width='8')
    stimulus (scl=rwb pcfiles=rw regfiles=w)
sfr (key=OSCCAL addr=0x5 size=1 access='rw rw rw rw rw rw rw u')
    reset (por='xxxxxxx-' mclr='uuuuuuu-')
    bit (names='CAL -' width='7 1')
sfr (key=GPIO addr=0x6 size=1 access='u u rw rw r rw rw rw')
    reset (por='--xxxxxx' mclr='--uuuuuu')
    bit (names='- - GP5 GP4 GP3 GP2 GP1 GP0' width='1 1 1 1 1 1 1 1')
    bit (tag=scl names='GP' width='8')
    stimulus (scl=rwb pcfiles=rw regfiles=rw)

######################################################################
#
# Non Memory-Mapped Registers
#
# (Conditionally visible SFRs appear as NMMRs in the "Special Function
# Registers" section.)
#
######################################################################

HasNMMR=1
nmmr (key=WREG addr=0x0 size=1 access='rw rw rw rw rw rw rw rw')
    reset (por='qqqqqqqq' mclr='qqqqqqqq')
    bit (names='WREG' width='8')
nmmr (key=STKPTR addr=0x1 size=1 flags=h access='rw rw rw rw rw rw rw rw')
    reset (por='00000000' mclr='00000000')
    bit (names='STKPTR' width='8')
nmmr (key=TRISIO addr=0x3 size=1 access='u u rw rw rw rw rw rw')
    reset (por='--111111' mclr='--111111')
    bit (names='- - TRISIO5 TRISIO4 TRISIO3 TRISIO2 TRISIO1 TRISIO0' width='1 1 1 1 1 1 1 1')
nmmr (key=OPTION_REG addr=0x5 size=1 access='rw rw rw rw rw rw rw rw')
    reset (por='11111111' mclr='11111111')
    bit (names='nGPWU nGPPU T0CS T0SE PSA PS' width='1 1 1 1 1 3')
NMMRObjSize=4

######################################################################
#
# Configuration Registers
#
######################################################################

cfgbits (key=CONFIG addr=0xfff unused=0x0)
    field (key=OSC mask=0x3 desc="Oscillator Selection bits")
        setting (req=0x3 value=0x3 desc="external RC oscillator")
        setting (req=0x3 value=0x0 desc="LP oscillator")
        setting (req=0x3 value=0x1 desc="XT oscillator")
        setting (req=0x3 value=0x2 desc="internal RC oscillator")
    field (key=WDT mask=0x4 desc="Watchdog Timer Enable bit")
        setting (req=0x4 value=0x4 desc="Enabled")
        setting (req=0x4 value=0x0 desc="Disabled")
    field (key=CP mask=0x8 desc="Code Protection bit")
        setting (req=0x8 value=0x8 desc="Disabled")
            checksum (type=0x0 protregion=0x0-0x0)
        setting (req=0x8 value=0x0 desc="Enabled")
            checksum (type=0x20 protregion=0x40-0x3fe)
    field (key=MCLRE mask=0x10 desc="GP3/MCLR Pin Function Select bit")
        setting (req=0x10 value=0x10 desc="Enabled")
        setting (req=0x10 value=0x0 desc="Disabled")

ad occhio direi che devo guardarmi l' ultimo pezzo pero non ci capisco molto . se la soluzione e qui vedrò di studiarmelo un po :ok:
Avatar utente
Foto Utenteramboluis
80 1 7
Stabilizzato
Stabilizzato
 
Messaggi: 314
Iscritto il: 28 giu 2012, 18:39

0
voti

[16] Re: config word PIC 12F509

Messaggioda Foto Utenteramboluis » 22 mag 2013, 16:50

sostituendo
Codice: Seleziona tutto
FOSC_INTRC


con

Codice: Seleziona tutto
0x2


mplab mi compila il codice senza problemi
Avatar utente
Foto Utenteramboluis
80 1 7
Stabilizzato
Stabilizzato
 
Messaggi: 314
Iscritto il: 28 giu 2012, 18:39

0
voti

[17] Re: config word PIC 12F509

Messaggioda Foto Utentesimo85 » 22 mag 2013, 17:07

La risposta a questo quesito ce l'hai a pag. 42 del datasheet che hai linkato. ;-)
Avatar utente
Foto Utentesimo85
30,9k 7 12 13
Disattivato su sua richiesta
 
Messaggi: 9927
Iscritto il: 30 ago 2010, 4:59

0
voti

[18] Re: config word PIC 12F509

Messaggioda Foto Utenteramboluis » 26 mag 2013, 21:12

simo85 ha scritto:La risposta a questo quesito ce l'hai a pag. 42 del datasheet che hai linkato.


ho guardato piu volte il datasheet ma sinceramente non riesco a capire la tua affermazione :oops:
cosa che dovrei trovare ?

io a pagina 42 ho visto le costanti per settare la config word
Avatar utente
Foto Utenteramboluis
80 1 7
Stabilizzato
Stabilizzato
 
Messaggi: 314
Iscritto il: 28 giu 2012, 18:39

0
voti

[19] Re: config word PIC 12F509

Messaggioda Foto Utentesimo85 » 26 mag 2013, 21:21

ramboluis ha scritto:io a pagina 42 ho visto le costanti per settare la config word

Appunto a quello mi riferisco.

Le costanti hanno un nome ed un valore.
Veramente, per il tuo scopo, cosa importa sapere il nome, se quello che conta è il suo valore? ;-)
Avatar utente
Foto Utentesimo85
30,9k 7 12 13
Disattivato su sua richiesta
 
Messaggi: 9927
Iscritto il: 30 ago 2010, 4:59

Precedente

Torna a Firmware e programmazione

Chi c’è in linea

Visitano il forum: Nessuno e 18 ospiti