I thought I had this problem licked. Then I purchased PCB PRO and tried to run the same code that ran in PCB. I get all an "Overwriting prrevious address contents" assembly error and many "Symbol not previously defined erros" as related to the ANSEL, ANSELH, CM1CON and CM2CON statements as shown in the attached image. These errors sort of sound like a problem with the CONFIG statement not being commented out in the .inc file. I did make sure I commented out the @ __device statement in the 16F690.incl file that came with PCB PRO so it isn't overwritten by the !__config statement in the code.
Can't figure thwhy this code now won't assemble. Can any of you advise me why my code would run in PCB and won't assemble in PCB PRO??
Here is the current code as adapted from Bruce's "Non-Interrupt version" in his above post.
Code:@ __config _INTRC_OSC_NOCLKOUT & _WDT_OFF & _MCLRE_OFF & _CP_OFF i var Byte ' Indexer for use in For..Next loop K CON 15 ' Calibration factor for flow meter = # pulses per gal ' Setup Timer0 as an 8-bit counter with the clock input on RA2. ' 1:1 TMR0 prescaler ' TMR0 counts on high-to-low transitions OPTION_REG = %00111000 ' A/D & Comparators disabled ANSEL=0 ' all digital ANSELH=0 ' analog module disabled CM1CON0=0 CM2CON0=0 ' Port setup PORTA = 0 ' Clear the port register latches PORTB = 0 PORTC = 0 ' LEDs off, PULSOUT RC3 provides a high-going pulse ' Set or clear the data direction registers TRISA = %11111111 ' RA2 = TMR0 clock input for simulated meter pulse inputs TRISB = %11111111 TRISC = %11110000 ' lower 4 pins outputs 'VRCON = %00000000 ' turns the Vref Module OFF by clearing bit 7, 6, 4 TMR0 = 0 ' clear TMR0 count Main: IF TMR0 < K THEN ' Keep the valve open...do nothing..let water flow ELSE PULSOUT PORTC.3,1000 ' Generate required 10 msec pulse to RC3..close valve DEFINE WRITE_INT 1 WRITE 7, TMR0 ' write count if you need to during testing TMR0 = 0 ' Clear timer count For i = 1 to 3 ' Blink LED 3x to indicate valve turned off HIGH PORTC.0 PAUSE 500 LOW PORTC.0 Next ENDIF GOTO Main ' Loop to Main to wait for next meter flow input




Bookmarks