You may need to type intcon etc in upper case. That is any register names such as TMR0 etc should all be in uppercase. ************************************************* Roy Hopkins rdhopkins@ihug.co.nz ************************************************* ----- Original Message ----- From: "Tom Dickinson" To: Sent: Saturday, January 24, 2004 12:09 PM Subject: [PIC]: Trouble assembling code for 16F84A > I'm new to PIC programming and my problem is that the assembler (both > MPLAB and MPASMdos) doesn't seem to load the internal register > definitions from the 16F84A.inc file. I would hate to have to declare > all these registers as equates in my source file. > > Here is the first part of my code. I tried to copy exactly the format > shown in the "MPLAB IDE v6.xx" Quick Start doc. > > title RADCNT07 -Measure time between rad mon counts, calc mr/hr > ; > ; This program uses TMR0 overflow interrupt to increment 16 bit > ; register (timer). When a count comes in from the radiation monitor, the > ; value in timer is divided into a 16 bit constant to give an 8 bit number > ; corresponding to the radiation level (quotient of 256 = 5 mr/hr). The > ; 8 bit number is put out on portb and a R-2R resistor ladder provides an > ; analog level, 256 = 5 volts, 1 = .02 volts. This is displayed on a DVM. > ; > > ; Tom Dickinson > ; 01/21/04 > ; > list P=PIC16F84A, R=DEC > #include > ; > __CONFIG _CP_OFF & _WDT_OFF & _XT_OSC & _PWRTE_ON > ; registers > CBLOCK 0x020 > timer:2 ;16 bit running time count > radtime:2 ;16 bit time between rad monitor counts > temp:2 ;16 bit register used in compare and divide routines > radval:2 ;calculated radiation level; 256 = 5 mr/hr > radconst:2 ;constant divided by radtime to give radval > divisor:2 ; used > dividend:2 ; in 16 bit > quotient:2 ; divide routine > scratch ;8 bit register used in compare and divide routines > ENDC > ; > org 0x000 > goto start > org 0x004 > intsrvr bcf intcon,2 ;clear int flag > clrf tmr0 > incfsz timer,f ;if timerlo rolls over, skip to high byte > goto comp_time > incfsz timer+1,f ;skip to alarm if 16 bit rollover > goto comp_time > bsf porta,1 ;turn on fail alarm LED on RA1 (more > ; than an hour has gone by). > comp_time bcf status,0 ;clear carry > rrf radtime,w ;double last intercount > movwf temp ; interval and store > rrf radtime+1,w ; result in temp > movwf temp+1 > subwf timer+1,w ;compare doubled > movwf scratch ; value with > movf temp,w ; time since > subwf timer,w ; last > btfss status,0 ; input count > decf scratch,f ;if equal/less, > iorwf scratch,w ; that is, > btfsc status,2 ; if result is zero > goto rampdown ;or > btfsc scratch,7 ;negative then execute rampdown, > goto rampdown ; else > retfie ;return from interrupt > > ----- and so on for a couple of pages I won't bore you with--- > > When I assembled (build all), there were 43 errors as I recall, and > aside from a couple of typos, they were all "Symbol not previously > defined ( )". At the 4th instruction it was (intcon), at the 5th it was > (tmr0), and so on through (status), (porta) etc. It did not complain > about the __CONFIG symbols, but I'm concerned that it hasn't read these > either. The funny thing is, at the end of the list file (after all the > errors listed in my code), the symbol table gives the correct values for > all of these. I got the same result using MPASM in DOS ( I had to > declare 16F84 rather than 16F84A since my version doesn't have the A). > > What am I doing wrong? It would be a nuisance to have to declare > registers manually, but I'm mostly worried about not getting the config > and other information from the .inc file. Please advise. > > Tom > > -- > http://www.piclist.com hint: The list server can filter out subtopics > (like ads or off topics) for you. See http://www.piclist.com/#topics > --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.564 / Virus Database: 356 - Release Date: 19/01/2004 -- http://www.piclist.com hint: The list server can filter out subtopics (like ads or off topics) for you. See http://www.piclist.com/#topics