COUNT is not counting again


Results 1 to 34 of 34

Threaded View

  1. #28
    Join Date
    Mar 2009
    Location
    Colorado
    Posts
    378


    Did you find this post helpful? Yes | No

    Angry Now same working code won't work with PCB Pro??

    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
    Attached Images Attached Images  

Similar Threads

  1. Can't get COUNT to count
    By jellis00 in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 24th March 2009, 00:14
  2. Remain counting while sending out a pulse
    By ultiblade in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 10th January 2007, 16:51
  3. hardware counting while software runs
    By Archangel in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 2nd October 2006, 04:26
  4. continious counting process (capture)
    By asynch in forum General
    Replies: 1
    Last Post: - 17th February 2006, 08:42
  5. Count command
    By hawk72501 in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 6th September 2005, 20:04

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts