Programming to send the ouput from the ADC 0831 via serial port
erick_2987
Posts: 11
Hi,
i want to do a programming to send digital output from the ADC 0831 to computer serial port via RS232 cable. The input from the serial port(computer) will be recorded for 10 seconds and process via matlab.
i need some guidance from u guys to make the BS2P mc to send data from ADC for 10 sec and pause a while and send data again as loop. Thank you.
i want to do a programming to send digital output from the ADC 0831 to computer serial port via RS232 cable. The input from the serial port(computer) will be recorded for 10 seconds and process via matlab.
i need some guidance from u guys to make the BS2P mc to send data from ADC for 10 sec and pause a while and send data again as loop. Thank you.
Comments
To send data to the PC, use the DEBUG statement. The Basic Stamp Syntax and Reference Manual describes this in detail. The "What's a Microcontroller?" tutorial in the tutorials webpage is a good introduction to Stamp Basic and will show you how to pause and make loops.
How many samples do you expect in 10 seconds? How regular do they have to be? Do you want to read and save the samples first, then send them to the PC during the pause? The BS2 has 2K of EEPROM for your program and a simple program won't take that much. You could store a couple of hundred samples in the EEPROM and then send them to the PC separately. Remember that it takes about 1ms per character to transmit a message to the PC and the Stamp can't sample the ADC while it's transmitting. It also takes a few ms to store a value in the EEPROM.
You need something like a Propeller for that sort of sample speed. The Propeller also has enough memory to keep the samples in SRAM which doesn't have the speed limitation of EEPROM. You could attach a Ramtron FRAM to your Stamp or Propeller for a memory that behaves like EEPROM, but doesn't have the speed limitation. 5ms is still too little time for a BS2. You might manage with a BS2px and could use the built-in I2C statements to access a FRAM to store the samples.
Remember that MATLAB can't "retrieve" the stored samples from any Stamp or Propeller. There has to be a program in the Stamp (or Propeller) that gets the stored samples and sends them to MATLAB.
http://forums.parallax.com/showthread.php?130180-help-with-Matlab-and-serial-communication