Basic stamp 2P "talks" too fast, so Basic Stamp 2 can't keep up.
CuriousOne
Posts: 931
Hello.
I'm doing simple project of communicating two basic stamp modules via RS-485, as written in "STAMP2: Communication and control projects" book. The problem is, that I have only two modules, BS2 and BS2P, and when built device as in book, it does not works. I've checked wiring, code many times, no luck. Then I decided to swap the modules, and check with oscilloscope their output. As you can see on attached screenshot, (using same horisontal resolution for both modules, BS2P is blue and BS2 green), BS2P outputs much shorter pulses than BS2, so I think, this is the reason why they can't synchronise. Below is the code for both (TX/RX) modules:
TX:
RX:
What I can do to make them work? how to slow down BS2P? insert PAUSE?
I'm doing simple project of communicating two basic stamp modules via RS-485, as written in "STAMP2: Communication and control projects" book. The problem is, that I have only two modules, BS2 and BS2P, and when built device as in book, it does not works. I've checked wiring, code many times, no luck. Then I decided to swap the modules, and check with oscilloscope their output. As you can see on attached screenshot, (using same horisontal resolution for both modules, BS2P is blue and BS2 green), BS2P outputs much shorter pulses than BS2, so I think, this is the reason why they can't synchronise. Below is the code for both (TX/RX) modules:
TX:
' {$STAMP BS2p} ' {$PBASIC 2.5} btnwk VAR Byte INPUT 2 OUTPUT 0 HIGH 0 IF (IN2<>1) THEN loop1 SEROUT 1,16468,1,["H"] loop1: BUTTON 2,0,255,0,btnwk,1,preloop2 GOTO loop1 preloop2: SEROUT 1,16468,1,["L"] loop2: BUTTON 2,1,255,250,btnwk,1,loop_again GOTO loop2 loop_again: SEROUT 1,16468,1,["H"] GOTO loop1:
RX:
' {$STAMP BS2} ' {$PBASIC 2.5} string VAR Byte OUTPUT 2 OUTPUT 0 LOW 0 loop1: SERIN 1,16468,60000,loop1,[string] IF(string<>"H") THEN is_low HIGH 2 GOTO loop1 is_LOW: LOW 2 GOTO loop1
What I can do to make them work? how to slow down BS2P? insert PAUSE?
Comments
speed up BS2, or slow down BS2P ?
Not to be confused with what he has now, which are that the baud parameters are the same values, but they shouldn't be for the models of BASIC Stamp he's using.