Counting led blinks..


Results 1 to 40 of 93

Threaded View

  1. #1
    Join Date
    Jun 2011
    Location
    Philippines
    Posts
    223

    Default Counting led blinks..

    Hi everyone, I have a coin acceptor that gives out pulse. Coins used are P1, P5 and P10. When I drop P1 it gives 1 blink to my led status, P5 it gives 5 blinks and P10 gives 10 blinks. I want to display the corresponding blinks on the LCD. I tried the following code and connected the .
    Code:
    DEFINE LCD_DREG PORTBDEFINE LCD_DBIT 0
    DEFINE LCD_EREG PORTB
    DEFINE LCD_EBIT 5
    DEFINE LCD_RSREG PORTB
    DEFINE LCD_RSBIT 4
    DEFINE LCD_BITS 4
    DEFINE LCD_LINES 2
    DEFINE LCD_COMMANDUS 2000
    DEFINE LCD_DATAUS 50
    Define OSC 20
    ADCON1 = 7 'Need this to turn off ADC   
    
    TRISB = 000011 'Pins A are in input mode
    PortB = 0
    W1 var byte
    Clear 
    
    
    pause 100
    Lcdout $fe, 1        ' Clear screen
    Lcdout "Blink Counter"       ' Display "Test Counter"
    Init:
    COUNT PORTB.1, 60, W1
    Lcdout $fe, 1        ' Clear screen
       Lcdout "Digital Designs"       
       Lcdout $fe, $c0, "Read: " , #W1
       pause 1000
    GOTO Init 'Do it always
    But it displays erratic values. Can anyone guide me on this?
    Diagram
    Name:  diagram1.gif
Views: 2127
Size:  4.9 KB

    regards,
    tacbanon
    Last edited by tacbanon; - 23rd September 2011 at 16:39.

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