Shop OBEX P1 Docs P2 Docs Learn Events
TX from BS2 and RX into SX28/52 ?? — Parallax Forums

TX from BS2 and RX into SX28/52 ??

T&E EngineerT&E Engineer Posts: 1,396
edited 2007-03-26 00:15 in General Discussion
What is the easiest way to transmit a character or string from a BS2 and receive it in an SX (using SX/B).

I have done this before in reverse (Transmit a character from a SX28 to be received into a BS2) - but I want to do the opposite and can't get the coding right.

What I want to do is send DS1302 RTC information from a BS2 circuit over to an SX52 so I can display the information on my 16x16 LED display.

Please help if you can.

Thanks.

·

Comments

  • Capt. QuirkCapt. Quirk Posts: 872
    edited 2007-03-25 01:01
    The Serial LCD example in the help section does that. After doing the example, I think it's easier using the BS2 to send the data to the SX.

    At least with the BS2, you should be able to send the Hi-byte and Lo-byte on the same line? but I don't know if thats the way SX/B would recieve it?

    Post Edited (Capt. Quirk) : 3/25/2007 1:11:40 AM GMT
  • T&E EngineerT&E Engineer Posts: 1,396
    edited 2007-03-25 01:18
    I never noticed the BS2 program at the end of the SX program.

    It looks like this can be made entirely on a Professional Development Board with a Parrallel LCD (which I have both).

    What I dont' see immediately is what to do with the SX28 IO lines (RC).

    The SX input goes to pin 15 on the BS2 but what about eh 8 IO lines from the SX28?

    Thanks. I will try this in the morning.
  • Capt. QuirkCapt. Quirk Posts: 872
    edited 2007-03-25 18:25
    Jonny Mac
    At EFX-TEK we use open-baudmode serial communications and Parallax's AppMod protocol to communicate with multiple, addressable devices on a single-wire buss (our AP-8, DC-16, and RC-4 all use the SX and are programmed in SX/B). Since SERIN and SEROUT are in place, and it's easy to add ISR-driven UART code, that might be your cleanest solution.
    Jonny Mac helped me out a lot with this thread http://forums.parallax.com/showthread.php?p=634214·especialy with the AppMod protocol. hope this helps, I know you have been doing this for a long time.
  • T&E EngineerT&E Engineer Posts: 1,396
    edited 2007-03-25 19:36
    I have gotten fustrated too many times on this project and almost to the point of giving up.

    All I wanted to do is display time and date information on my SX52 protoboard 16x16 LED matrix that JonnyMac has helped me with. However, as I am running out of variable space on the SX52 circuit, I thought perhaps displaying time and date info on an SX28 would be doable and then transfer·bytes over to the SX52 circuit.

    However, since very little if any information exists about a DS1302 interfacing with an SX28, I thought I would start with a·DS1302 interface with a BS2 since it has the DEBUG capability that the SX28 lacks. Going forward I have tried to send over the data between the BS2 and SX52 circuits and I can get single characters but not entire strings of date and time information.

    I have attached the code I am working with for both BS2 and SX52 for anyone interested in looking it over.


    Post Edited (T&E Engineer) : 3/25/2007 7:54:32 PM GMT
  • Capt. QuirkCapt. Quirk Posts: 872
    edited 2007-03-25 20:51
    You don't need the Cmd THEN GOTO Write, the BS2 is sending a control or LCD address byte thru "CMD" then the string. So all you are seeing is the single byte location instruction.

    You need to change your BS2 code to just send the strings and nothing else.

    Main:
    · serByte = RX_BYTE··········· ' wait for byte
    · IF serByte <> Cmd THEN
    · Goto Write··················· ' command?
    · ENDIF
    Goto Main

    Write:
    · Scroll_Dir = 0
    · tmpB1 = 0
    · tmpB2 = 2
    · StringWriter
    Goto Main
    I think all you need is this
    RX_BYTE:
    · SERIN Sio, Baud, tmpB1······················· ' receive a byte
    · RETURN tmpB1
    on the BS2 side SEROUT Sio, Baud,[noparse][[/noparse]"SERIAL LCD"]· (brackets included)
    Post Edited (Capt. Quirk) : 3/25/2007 9:03:08 PM GMT
  • T&amp;E EngineerT&amp;E Engineer Posts: 1,396
    edited 2007-03-26 00:15
    Thanks for the help. I tried what you described (see attached code programs).

    All I see is the first letter "S" (from Serial LCD) repeated over and over. I think it is because it may take too much time in the STRINGWRITTER routine in sx/b to decode each letter - but not completely sure.

    I have also worked on another program (in the reverse way - attached programs). It uses an SX28 to decode a 3x5 keypad (see SX/B 4x4 example for the basics). It displays the character on an 7 seg LED and also transmits it to the BS2 (which I can display the correct keypad entry - 0,1,2,3,4,5,6,7,8,9,A,B,C,D or E. However, it transmits from the SX and receives at the BS2. It is working perfectly.

    This program is the opposite of what I want to do with the 16x16 display and BS2 clock (transmits from the BS2 and receives at the SX52).

    PS: I also noticed that I sent the wrong BS2 program last time (the HC4LED-xxx is the correct one). The 1st 2 programs are the problem ones and the last 3 programs are the (reversed ones) working for 3x5 keypad from SX28 to BS2.

    Thanks.
Sign In or Register to comment.