We can set up the LogoChip to use serial communication by running the serialcomm.pb PicoBlocks program from the website. Two output pins of the LogoChip are now rx2 and tx2 lines for use in serial communication. (The rx2 is also connected to +4V via a 10 kOhm pullup resistor, while the tx2 does not need to be connected to anything else.) Note that only one set of rx and tx lines may be in use at the same time!!!
We can send the following numbers to the LogoChip (via PicoBlocks) and observe the resulting transmitted byte on an oscilloscope
Pictures taken by Hannah
Since the bit time was 52 microseconds, the baud rate is 19200
We can vary the baud rate by varying the init block in PicoBlocks. In particular, we can change the value of X in the line "write $238 X". From the actual tech specs, we know that the baud rate is 1/(X+1).
The LogoChip records 10 bit sensor values, so we need to break the number into a low byte and high byte number. The low byte has the 8 LSB, and the high byte has the 2 MSB (and some 0s).
The PicoBlocks program to implement this is pretty short
Note that we will be using two's complement to transmit negative numbers.
We can use MATLAB to collect and graph the light sensor data! The LogoChip will then turn on the LED depending on how much light is detected by the sensor. Here is the MATLAB code. (Note that I am linking to Hannah's site here, and for the other MATLAB codes)
Video by Hannah
We then use a USB-GPIB interface to connect a function generator to our computer, using the MATLAB code here.
We can play lots of things, including Mary Had a Little Lamb! (MATLAB code for Mary Had a Little Lamb here; code for playing an octave here.)
Video by Hannah