In SX Microcontrollers, SX/B Compiler and SX-Key Tool, JonnyMac wrote: Okay... if you can't get [u]working[/u] programs working there may be nothing I can say/write that will help. That said, I'll try... one last time. * Don't assume you've connected anything correctly -- [u]very dangerous[/u]; I had to reconnect things two or three times yesterday before I got the first programs working; once the connections were correct everything after that was a breeze. I even walked away a couple times when frustrated. I've been doing this a long time and it took some effort; you keep reminding us that you're a newbie so I'm going to drop the connections thing on you ( bet you'll stop calling yourself a newbie now.... :tongue: ) * Next to the PDB my favorite development tool is a white board and lots of color markers; I did this drawing yesterday to get my head around what I wanted to do: SX.TX (o) ---> BS2.RX (i) SX.RTS (i) <--- BS2.CTS (o) SX.RX (i) <--- BS2.TX (o) SX.CTS (o) ---> BS2.RTS (i) This should get your connections straight and help you with the code (it did for me). * If you're switching the SX to 50MHz then change OSCXT2 to OSCHS2. I just re-ran the programs using a 50MHz resonator on the SX (instead of the Key) and it still works. See page 50 of the SX-Key manual for OSC recommendations. I tend to use OSCXT2 for 4MHz, 8MHz and 20MHz, and OSCHS2 for 50MHz -- that's based on using the resonators I have (same as what Parallax sells). See section 9.0 of the SX28 docs for gory details on oscillator circuits (what I'm really saying is that using SX/B does not relieve you of any responsibility to learn the SX and connecting things to it). * When using True mode serial the idle state of the TX line is output-high (1); this needs to be done at start-up (both programs do). * Using hardware flow-control (HFC) with True mode the CTS pin will be high (1) to stop incoming serial, and go low (0) to allow it. The CTS pin should be initialized output-high to prevent the other side from trying to transmit until this side is ready. The CTS of the receiving device connects to the RTS of the transmitting device (see above). The transmitting device will watch for its RTS input to go low before transmitting. * Okay, blow-by-blow: The BS2 wants to transmit a byte to the SX via its TX_BYTE subroutine. Using HFC it checks its own RTS input to see if the SX is ready to receive; when RTS is low (0) the byte will be transmitted. On the SX side the RX_BYTE function signals that it's ready by taking its CTS output low then dropping into SERIN. Once the byte as been received by the SX the CTS line is taken back high; this stops the BS2 from sending anything else. Going the other direction... when the BS2 is ready to receive a byte it goes to its RX_BYTE subroutine where, again using HFC, it will take its CTS pin low to signal the SX that it's ready. When the SX's TX_BYTE function sees its RTS input go low it will transmit a byte to the waiting BS2. Everybody is happy -- I've given you three sets of programs that prove it! :smilewinkgrin: * Finally.... I used to work for a guy named Bob who said ever person needs to see/hear/read something three to seven times before it sinks in -- you may need to re-read some material as we all have different rates at which the "Aha!" light illuminates. Don't assume that reading things once or twice will be enough; you're human, allow yourself to be. And keep experimenting... that's a much better way to learn than counting on windbags like me! ---------- End of Message ---------- You can view the post on-line at: http://forums.parallax.com/forums/default.aspx?f=7&p=4&m=324554#m327005 Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2009 (http://www.dotNetBB.com)