« See updates here | Main | Qprox »
October 11, 2005
Serial
In order to make two devices communicate, whether they are desktop computers, microcontrollers, or any other form of integrated circuit, we need a method of communication and an agreed-upon language. The most common form of communication between electronic devices is serial communication. Communicating serially involves sending a series of digital pulses back and forth between devices at a mutually agreed-upon rate. The sender sends pulses representing the data to be sent at the agreed-upon data rate, and the receiver listens for pulses at that same rate.
Two devices are to exchange data at a rate of 9600 bits per second. First, we would make three connections between the two devices:
- a common ground connection, so both devices have a common reference point to measure voltage by
-one wire for the sender to send data to the receiver on (transmit line for the sender)
-one wire for the receiver to send date to the sender on (receive line)
The ASCII table
Serial to Processing
Serial Output Lab
Talking to Processing
Basics, talking to the Pic to convert the ascii into readable numbers.Download file
Ascii, call and response. In the communicator, only when an "A" (ascii=65) is inputted, it will show "you got me" otherwise, the else goes. Download file
Here the values of the analog in (ex. pots) gets read and out put as readable values. Download file
It's funny. We've had this weird problem in the firmware lab. Certain machines simply wouldn't process the codes on the PICBASIC. Instead, I had a problem with PROCESSING. I was getting serial communication when I opened up the Serial Communicator, getting values as I inputted "A" (65 ASCII). The lab was full and I had no choice but to try to figure out what was happening with my code. I tried on someone else's machine and it worked fine! Ah the frustration...
Here are some pics.
The analog inputs (pots, flex sensors, pressure sensors, photocells go on the left) A ports. And the communication is done on the C ports 6(Send out, transmit) and 7 (In, receive).
After compiling, opening up the processing code, pops up this window with the circle. Using the different analog inputs, you can change it's transparancy, xpos and ypos. Cool!
Here's the code for the pic to talk to processing.Download file
And this is what you see on the screen.
The processing code.Download file
There are so many ways to go further with this. Alice and I had built on my very first electronic assignment.
We have LEDs, switches and we'd like to have this happen on the screen as well, in processing. Hope we can get this done. The laser cutter cuts so clean! :) We have the coding done, the board is ready, all we need is the plexi now! Getting this done tomorrow! Hopefully, I'll have this done by Thursday.
Posted by min at October 11, 2005 12:14 AM