breadboard and hserout interference?


Closed Thread
Results 1 to 10 of 10

Hybrid View

  1. #1
    Join Date
    Sep 2003
    Location
    Vermont
    Posts
    373


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by mister_e
    my bet is more about possibility of a buffer overflow.
    Try this one for the transmitter
    Code:
    Set transmit register to transmitter enabled
    DEFINE HSER_TXSTA 20h
    
    ' Set baud rate
    DEFINE HSER_BAUD 2400
    
    cmcon = 7
    
    Main:
    
        If (PORTA.1 = 0) then
            hserout ["1"]
            while PORTA.1=0 : Wend : pause 500
            endif
        if (PORTA.1 = 1) then
            hserout ["2"]
            while PORTA.1=1 : wend : pause 500        
            endif
    
    goto main
    end
    what about your crystal speed? Config fuses? Schematic?
    It sounds like you only want to send a character on the state change of the switch. Use a bit variable such as current_state for the last known state.
    This way, you won't hang the program up waiting for the switch to change.

    Read_switch:
    if (PORTA.1= current_state) then goto main ; No change goto main program
    hserout [PORTA.1 + $30] ; Make the switch value the ASCII equivelent and send it.
    current_state = PORTA.1 ; Current_state = switch value
    goto main ; How neat is that?!?

  2. #2
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Talking

    for sure i need to sleep!
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

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