Hserin problems


Closed Thread
Results 1 to 1 of 1

Thread: Hserin problems

  1. #1
    Join Date
    Aug 2006
    Posts
    20

    Default Hserin problems

    Hi all,

    I guess there's a problem with the code I've written but I cannot see where. I'm trying to rx a character, test it then if OK then drive a port. I've tried all soughts of variations but to no avail.

    Help appreciated.

    John

    Here's the code:

    ' Initialize USART
    TRISA = %11111101 ' port A1 set to out
    TRISB = %11110010 ' Set TX (PortB.1) to out
    SPBRG = 25 ' Set baud rate to 2400
    RCSTA = %10010000 ' Enable serial port and continuous receive
    TXSTA = %00100000 ' Enable transmit and asynchronous mode

    loop: Gosub charin ' Get a character from serial input, if any
    If B1 = 0 Then loop ' No character yet
    IF B1 = "A" THEN
    HIGH PORTA.1
    endif
    'IF B1 = "C" THEN LOW PORTA.1
    Gosub charout 'this works fine
    Goto loop ' Do it forever


    ' Subroutine to get a character from USART receiver
    charin: B1 = 0 ' Preset to no character received
    hserin [B1]

    Return
    Last edited by nicjo; - 27th November 2006 at 10:19.

Similar Threads

  1. HSerin problems on power up
    By Luckyborg in forum Serial
    Replies: 8
    Last Post: - 21st April 2009, 19:49
  2. Replies: 288
    Last Post: - 25th August 2008, 16:53
  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. hserin problems
    By HELDERFERRAZ in forum Serial
    Replies: 0
    Last Post: - 10th February 2006, 23:41

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