Shop OBEX P1 Docs P2 Docs Learn Events
UHF receiver to USB datalogger with BS2 — Parallax Forums

UHF receiver to USB datalogger with BS2

FerwerdaFerwerda Posts: 3
edited 2010-09-14 02:10 in BASIC Stamp
Can anyone help me with advice or a sample code, which could point me in the right direction, since I'm a noob in basic stamp programming.

I have been trying to write data from the receiver to the datalogger.
The signal is digital and I have been able to show it on the Debug screen. (Sample rate was not correct though) The UHF connection is ASK modified with a NRZ line code and my tests were with a bit rate of 1000 baud.

Comments

  • FranklinFranklin Posts: 4,747
    edited 2010-09-02 12:55
    Show us the code you use to display it on the debug screen.
  • FerwerdaFerwerda Posts: 3
    edited 2010-09-06 23:53
    I've had some great progress, since figured out how to use serout en serin. I have been able to write data to it. However i've been using a function generator so before I can really check if it works, I have to connect my transmitter to my pc using Matlab. I will post my program as soon as I can do a good test.
  • FerwerdaFerwerda Posts: 3
    edited 2010-09-14 02:10
    The datalogger works, I can send as much information as needed the only problem I'am having is writing faster. How can I make an array of bytes, some sort of buffer, so I can write multiple bytes to the datalogger at once?

    This is my for loop now (this writes 1 byte at a time, which is too slow. I now have to pause between every new byte in Matlab since an handshake is not possible with the UHF receiver)

    FOR counter2 = 1 TO NumtotSamples
    SERIN UHF, 16572, [result] 'Baudrate = 4800 no parity


    DEBUG result ' Display Results
    SEROUT TX/ CTS,Baud,[$08,$20,$00,$00,$00,$0D,CR,result,CR,CR]
    GOSUB Write_Data ' Purge Receive Buffer

    NEXT

    Get_Data:
    index = 0 ' Reset Index Pointer
    DO ' Receive Data
    SERIN RX\RTS, Baud, 100, Timeout, [ioByte]
    buffer(index) = ioByte ' Add Received Byte To Buffer
    index = index + 1 ' Increment Index Pointer
    IF index > 14 THEN Timeout ' Check For Overflow
    LOOP

    Timeout:
    RETURN
Sign In or Register to comment.