PDA

View Full Version : Basic Stamp 2 Reading Serial Data



LW
03-29-2010, 12:42 AM
Hi im Very New to this so any help apreciated.

I have a piece of test equipment that has a pic Controller inside. the Pic sends out serial data as soon as its connected and continues to send the same serial data untill its powered off.

I want to send the serial data from the Pic to the stamp and have the stamp display the data on the pc screen and later on a lcd display. Im not sure in what format the serial data is but i think its just 4 numbers.
and ideas welcombe

Franklin
03-29-2010, 12:48 AM
Where does the pic send the data and how will you connect to it? What level is the data (TTL or RS232)? Read the section of the manual on SERIN and SEROUT for some ideas.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Stephen

bill190
03-29-2010, 02:34 AM
Also might want to search google.com for the words...

Asynchronous serial communication

LW
03-29-2010, 03:08 AM
Franklin said...
Where does the pic send the data and how will you connect to it? What level is the data (TTL or RS232)? Read the section of the manual on SERIN and SEROUT for some ideas.


The piece of equipment has an output connector which is wired to one of the pic output pins. I have scanned the output with a scope and it looks like its TTL level.
I now have the Pic and the Stamp mounted on a vero board running from the same supply and the data out from the pic is connected to Data pin 8 on the stamp.
I can connect the scope to the data line and see data being transmitted but cannot read it.

I have spent two weeks on and off reading both the SERIN command and SEROUT commands and have still not managed to read any data from the pic.

Lynton

Franklin
03-29-2010, 04:37 AM
Are you sure it is ascii serial data? Could just be 1's and 0's. If you can get your hands on a logic analyser like the logic from www.saleae.com or the bus pirate from seeed studios you could see what was really going on.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Stephen

mikediv
03-29-2010, 08:04 AM
LW maybe I can help but I need to know which PIC chip are you using do you have a copy of the software in the chip or is write protected it would also help if you had a schematic of the board with the PIC chip I bought a Chinese stepper controller that used a rather obscure PIC chip I ended up finding out it was compatible with a PIC 16F684 and I was able to sniff the serial line but to be honest its better to have a copy of the running code to decipher,, Do you use Mplab for your PIC chips?

stamptrol
03-29-2010, 08:17 AM
Is the test equipment designed to send data to a PC? That will tell you some important things about getting the Stamp to work with the data.

What is the data baudrate, parity, data bits, stop bits from the test equipment?

Does the test equipment manual describe what the data string looks like?

With these answers, getting the Stamp to listen should be quite doable.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tom Sisk

http://www.siskconsult.com

LW
03-29-2010, 11:16 PM
mikediv said...
LW maybe I can help but I need to know which PIC chip are you using do you have a copy of the software in the chip or is write protected it would also help if you had a schematic of the board with the PIC chip I bought a Chinese stepper controller that used a rather obscure PIC chip I ended up finding out it was compatible with a PIC 16F684 and I was able to sniff the serial line but to be honest its better to have a copy of the running code to decipher,, Do you use Mplab for your PIC chips?



Hi Mike Thanks for your Help.
The pic is 12F629 Both the program and the data is protected i have tried to read it but no joy. I have No circuit diagram although it looks a very simple circuit with only about a dozen components. I haven't tried programming pic chips yet, This was my first attempt and by the success I'm having so far I may not try many more.

LW
03-29-2010, 11:26 PM
stamptrol said...
Is the test equipment designed to send data to a PC? That will tell you some important things about getting the Stamp to work with the data.

What is the data baudrate, parity, data bits, stop bits from the test equipment?

Does the test equipment manual describe what the data string looks like?

With these answers, getting the Stamp to listen should be quite doable.


HI the test equipment was manufactured in china by a company whom have now ceased to exist. The instructions are very poor and say nothing about the communications used. The individual pieces of test equipment have their own unique identifier stored in the pic no other data is sent or received. When the units are plugged into the base unit for charging the base unit recognises which piece of test equipment is on charge and records the charging details for record. If i change the Pic from one unit to the other the Base unit then assumes the id is of the second unit.

Lynton

stamptrol
03-30-2010, 01:05 AM
Ah, so! It might not be a real serial protocol at all. Maybe be some sort of ttl level bit-banging.

This will require some benchtop investigating, doing some sample sniffing as was noted previously. If the data is only an ID, the exercise may not be worth the trouble, other than the intellectual stimulation of solving the riddle.

Cheers,

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tom Sisk

http://www.siskconsult.com