Basic Samp/PSC communication Problem
kennet
Posts: 33
I have one BS2p24/PSC running a program and would like to use a BS2p40 to control this setup in a Master/Slave combination. I want the BS2p40 to send serial commands to the program running· the BS2p24· not the PSC·.
Anyone·know how I can do this?
Thanks
Ken·
Anyone·know how I can do this?
Thanks
Ken·
Comments
This uses two I/O lines. You put 330 Ohm resistors in series between the two Stamp's I/O pins to protect them from programming mistakes.
There is a 10K pulldown on one lead on the BS2p24 end (pin X) and a 10K pulldown on the other lead on the BS2p40 end (pin Y).
When the BS2p40 wishes to send, it does a HIGH X. From time to time, the BS2p24 checks its X pin for a HIGH. When true, it does a HIGH Y and then waits at a SERIN X for a response, then does an INPUT Y. The BS2p40 (after it does the HIGH X) waits for the Y pin to go HIGH. When true, it uses up maybe 100us, then does a SEROUT, then INPUT X. There needs to be a short (maybe 100us) delay after all this for things to finish up before doing it again.
In this example, the format of the data has nothing to do with the PSC commands. It consists of 3 bytes. The first is the servo number and the next two bytes contains the servo pulse width.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Keep buying replacement parts and sooner or later you will get it RIGHT!
And Kenwtn,your right on time.Thanks for the code samples.You rule!
Thanks Fellas
Ken