Problems with HSERIN HSEROUT


Closed Thread
Results 1 to 3 of 3
  1. #1

    Unhappy Problems with Programm Code

    Hi,
    I have a little problem with my little codes.I push the buttons but dont receive data to PC ,but when i send data from PC to PIC 16F870 I receive data back,this is OK.This just happen when I put the codes together in Main:
    But When I live just the Buttons code in Main then data are incoming to PC.
    I think I can not use together RCIF and Buttons,I have a 4 Mhz Crystal and Max 232N.

    Define LOADER_USED 1

    Include "modedefs.bas" ' Mode definitions for Serout
    DEFINE OSC 4
    DEFINE HSER_RCSTA 90h ' Set receive status and control
    DEFINE HSER_TXSTA 24h ' Set transmit status and control + BRGH=1
    Define HSER_BAUD 9600
    DEFINE HSER_CLROERR 1
    ADCON1 = 7

    A0 var byte
    A1 var byte
    A2 var byte
    A3 var byte

    ' Alias definition
    ' ================
    '
    '
    RCIF VAR portc.7 ' Receive interrupt flag (1=full , 0=empty)
    TXIF VAR portc.6 ' Transmit interrupt flag (1=empty, 0=full)

    ' Variable definition
    ' ===================
    '
    '
    SerialData var byte
    ' Hardware initialisation
    ' =======================
    '
    '
    pause 10 ' safe start-up delay
    Main:
    if RCIF then ' incomming data?
    hserin [Serialdata] ' take it ' I think here is the problem
    hserout [Serialdata] ' send it
    endif
    BUTTON PORTA.0,0,255,1,A0,1,ML1
    BUTTON PORTA.1,1,255,0,A1,1,ML2
    BUTTON PORTA.2,1,255,0,A2,1,ML3 ' Or here I can not use all this
    BUTTON PORTA.3,1,255,0,A3,1,ML4 together
    goto Main


    ML1:
    Hserout ["M1"]
    goto main

    ML2:
    Hserout ["M2"]
    goto main

    ML3:
    Hserout ["M3"]
    goto main

    ML4:
    Hserout ["M4"]
    goto main
    End


    Please I need Help.
    Thanks a lot
    bye Pesti
    Last edited by Pesticida; - 19th September 2005 at 21:52. Reason: Title change

  2. #2
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Hi Pesti,

    The RCIF bit is in the PIR1 register. Not the RX pin itself.

    <pre>RCIF VAR PIR1.5<br>TXIF VAR PIR1.4</pre>
    DT

  3. #3


    Did you find this post helpful? Yes | No

    Default

    Thanks a lot Darrel,now is working!!!
    Have a nice day !

    Pesti

Similar Threads

  1. HSEROUT and Commas, What? Help Me Understand
    By altech6983 in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 20th July 2009, 19:12
  2. HSERIN and HSEROUT commands
    By ryan in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 6th January 2007, 22:11
  3. HSERIN and HSEROUT problems
    By amindzo in forum Serial
    Replies: 1
    Last Post: - 6th September 2006, 21:11
  4. HSERIN and HSEROUT problems
    By amindzo in forum General
    Replies: 2
    Last Post: - 31st August 2006, 06:51
  5. HSEROUT Problems
    By SergioRM in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 7th April 2005, 23:17

Members who have read this thread : 1

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