how to compare data


Results 1 to 20 of 20

Threaded View

  1. #5
    Join Date
    May 2008
    Location
    Italy
    Posts
    825


    Did you find this post helpful? Yes | No

    Default

    You simply put the IF/THEN in the wrong place. It must be within the FOR/NEXT loop.
    I don't see the setting for the TRIS registers.

    Al.

    Code:
    PORTA = 0
    PORTB = 0
    TrisA = %00000001  ' ????????????????
    TrisB = %00000000  ' ???????????????
    KEY VAR BYTE
    KEY1 VAR BYTE
    ADR VAR BYTE
    SYMBOL SCLK = PORTB.0
    SYMBOL SDAT = PORTB.1
    SYMBOL RELY = PORTB.3
    SYMBOL STRT = PORTA.0
    
    START:
    PAUSE 10
    IF STRT = 0 THEN GOSUB SCAN
    ENDIF
    GOTO START
    
    SCAN:
    FOR ADR = 0 TO 7
    I2CREAD SDAT,SCLK,$A0,ADR,[KEY]
    PAUSE 10
    READ ADR,KEY1
    PAUSE 10
    
    IF KEY = KEY1 THEN
    HIGH RELY 
    PAUSE 1000
    LOW RELY
    Pause 1000
    ENDIF
    
    NEXT ADR
    
    RETURN
    END 
    DATA @0,14,21,47,56,02,11,22,33
    Last edited by aratti; - 28th October 2009 at 23:04.
    All progress began with an idea

Similar Threads

  1. Using Nokia LCD
    By BobP in forum mel PIC BASIC Pro
    Replies: 300
    Last Post: - 3rd May 2018, 04:47
  2. Nokia 3310 display text
    By chai98a in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 26th August 2007, 03:39
  3. Big characters on HD44780 4x20
    By erpalma in forum mel PIC BASIC Pro
    Replies: 23
    Last Post: - 7th January 2007, 02:21
  4. LCD + bar graph
    By DynamoBen in forum mel PIC BASIC Pro
    Replies: 13
    Last Post: - 5th October 2005, 14:50
  5. Sinus calculating !
    By Don Mario in forum mel PIC BASIC Pro
    Replies: 29
    Last Post: - 28th November 2004, 23:56

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