Shop OBEX P1 Docs P2 Docs Learn Events
Serin/Serout — Parallax Forums

Serin/Serout

GuidoGuido Posts: 195
edited 2005-03-09 23:18 in BASIC Stamp
I would really appreciate some help with Serin/Serout. I have actually been able to get a Slave stamp running a clock and been able to access all information back to the master.....We I decided to explore adding another Slave Stamp with temperature using a DS1620. Here is my problem. How to you generate a Serin/Serout statement for the following. And I hope it is possible to add more slaves like in Jon's articile of Stamp to Stamp...
Here is the statement that I am having trouble with:

DEBUG REP "-"\TEMPF.BIT15,DEC TEMPF/10,".",DEC1 TEMPF," F ",CR

I realalize this is a debug statement, but anyway I try I can not get anything to work using serin/serout. As a matter of fact it is having an effect of the working clock program....
Still Learning
Guido

Comments

  • kb2hapkb2hap Posts: 218
    edited 2005-03-08 02:44
    could you post your complete code?
    what exactly is it doing?
    what exectly do you want to do?
    should you just be sending data from the slave to the master and formatting it in the master?
    more info please.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    DTQ
  • GuidoGuido Posts: 195
    edited 2005-03-08 12:18
    Hi,
    Let's try this again! The problem I seem to be having is when I connect the second slave stamp to the master...it will display correctly for a few seconds and then get very jittery and then ALL the data starts changing.

    SERIN SIOPIN\FCPIN,T2400,[noparse][[/noparse]DAY,MONTH,DATE,YEAR,HOURS,DEC3 TEMPF,DEC3 TL, DEC3 TH]

    I have put a delay after the serin but no help there....any ideas what I might try.

    Again the first slave is just a clock and the second slave is temperature....trying to start out small, but have trouble right now

    Thank You
  • kb2hapkb2hap Posts: 218
    edited 2005-03-08 12:26
    DO you have both stamps on the same network?
    or are the on seperate pins?
    maybe you should put some sort of wait command in there and when each on sends data there will be a start of data identifier like WAIT"X"
    they could be sending or receive before they are both ready
    I see you have fcpin are you using flow control?
    what stamps are you using?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    DTQ
  • GuidoGuido Posts: 195
    edited 2005-03-08 12:45
    All stamps are using the same pins, like the example Jon has in Stamp to Stamp.The only difference is I added an extra stamp and resisters like the diagram.
    I have a delay added to after the serin statement, but it really seems that when it is displaying clock the temperature display goes nuts and visa versa. Should I use two seperate serin statements?

    I am using bs2,bs2p and bs2pe
  • allanlane5allanlane5 Posts: 3,815
    edited 2005-03-08 14:00
    Why do you have a 'delay' put after the SERIN? You may need a delay after a SEROUT, so the 'recieving' unit can deal with the stuff you've just given it. You probably DON'T need a delay after SERIN.

    What you want to have happen is the 'reciever' sits in a SERIN statement, waiting for data. Then when the 'sender' sends a SEROUT, the reciever gets all of it.

    If the reciever starts its SERIN in the middle of the sender's SEROUT, then it will get garbled data.

    So you need some time between the 'senders' sends, so the reciever has some time to get to its next SERIN statement.

    Also -- the "T2400" is a BS1 constant, NOT a BS2/2e/2p constant.· You probably should read the manual on the SEROUT statement to find the right constants for the BS2, BS2e, and BS2p -- they are different.· You then must add the correct modifier (I think it's the "Open Baud Mode" modifier) to use the "open-collector" mode.

    You also must do some planning to insure that two 'senders' dont' try to send at the same time.· This may not be an issue for you.

    Post Edited (allanlane5) : 3/8/2005 2:03:04 PM GMT
  • Tom WalkerTom Walker Posts: 509
    edited 2005-03-08 16:22
    If I understand you correctly, you should probably begin by connecting the two "slave" stamps to different "master" pins. It sounds like both of your slaves are trying to send data at the same time and the master can't decipher the garble.

    I think more specifics about YOUR circuit are necessary before anyone can give more useful advice.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Truly Understand the Fundamentals and the Path will be so much easier...
  • kb2hapkb2hap Posts: 218
    edited 2005-03-08 16:52
    no he doesnt neccessarily need them connected to 2 different master pins he can have the slaves always listening and have the master send out like an "ok to send unit A" then once that transaction is complete it can send "ok to send unit b" like each one will have a different wait letter....(for example)
    your looking more at a chip select type of network

    you are going to have to do some playing around to get it all right
    because once the mater sends the ok then the slave will run its program to get either time or temp then send the data to the master. once the master is satisfied it will then do the same for the other slave.

    thats only one way to do it there are many other way you could do it

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    DTQ

    Post Edited (kb2hap) : 3/8/2005 5:10:12 PM GMT
  • Tom WalkerTom Walker Posts: 509
    edited 2005-03-08 18:54
    I understand that he doesn't NEED to use two pins, but an assumption I made (yeah, I know...) from reading his initial post is that he is somewhat inexperienced and has not thought about what is really happening (i.e. used a circuit from an article that did something and added a circuit from a different article to the same pin (and I suspect tried using the same SEROUT pin to request the data)), so I suggested that Guido try keeping two different ciucuits with two different functions separate until he has a better grasp of things.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Truly Understand the Fundamentals and the Path will be so much easier...
  • kb2hapkb2hap Posts: 218
    edited 2005-03-08 21:11
    depending on how many pins he's using he could either make the 2 slaves totally seperate with totally seperate serin/serout line or he could go with 2 extra chip select lines
    what do ya think guido what do you feel most comfy with

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    DTQ
  • GuidoGuido Posts: 195
    edited 2005-03-08 22:53
    First of all you guys are fantastic....Yes indeed I am new, I did not think I could use another set of pins for a slave, but think I will attempt to fix what I do have. I like that one idea of having the master send out for an individual slave to serout....Going to do some experimenting!!!
    Thanks Again
    Probably be back, but I am having fun thanks to all of you!
  • GuidoGuido Posts: 195
    edited 2005-03-09 23:18
    Just want to Thank everyone for their help....I played sending a signal out for the remote to serout, but I was still getting erraric operation....Late last night I tried Tom's suggestion and everything is up and running...Will be adding two more remotes and do not see any more serin/serout problems I hope.....
    Thanks Again Everyone......
    Watch Out Guido will be attempting to use a remote eprom for saving Data...oh boy will I need help!!!! First of all I hope the heck you can write and read be addressable?
    Thanks Again
    Guido
Sign In or Register to comment.