FINAL WRITEUP INFO
mtg 4: EAGLE PCB CAD
lab 3 html
papers Johnny 5 pdf
mtg 3: laser cutter & HPGL
lab 2 html
HPGL manual pdf
mtg 2: intl ground vehicle comp
mtg 1: LogoChip & Bus Devices
metacricket paper html pdf
UML305DEV board assembly pdf manual pdf LogoChip
lang ref pdf
PIC 16F876 pdf
lab 1 html
LogoChip Bus Version
The LogoChip virtual machine has been extended to include background bus receive. Also the bus transmit (bsend) primitive works properly now.
Download the LogoChip ZIP archive here.
After unzipping, go into the "vm" folder and run the "ASM-LOADER" project. Click on the "assemble filename" button. You should see a display of the code size in the main window.
Next, hook up your LogoChip to the serial line, and power it on with the Run/Stop button held down. You should not see a boot flash.
Now, click the "load-asm" button on the ASM-LOADER screen. The button should stay in a "clicked down" state while the code downloads. You should also be able to see the green serial status LED on the UML305DEV board flashing during this process. If it completes without complaining, it worked.
Power on your LogoChip again, this time not holding down the button. You should see the boot flash. You can now run the "LC LOGO" project from the ZIP archive. Do not use the originally installed LC LOGO project anymore.
Port B0 (pin 21) acts as a bus send and receive pin.
Note that the bus requires a 1K resistor pullup to +5v to work properly. If you are using LogoChip as a bus slave and a Handy Cricket as the bus master, you do not need to add the pullup, because the Handy Cricket already has it.
On the other hand, if you are using LogoChip as a bus master to talk to some other bus devices, then you need the pullup.
The following new Logo primitives are available:
You must not write bit 0 of the Port B Data Direction Register to a zero. If you do so, the LogoChip will crash the bus, and no bus communication will be possible.
In this sample project, a Handy Cricket is the bus master and the LogoChip is the bus slave. There are three primary steps:
Step 1: Wire the Handy Cricket Bus to the LogoChip Bus. This is easy if you build the cable properly. There are three sub-steps here: (a) inserting the crimped wires into the bus plug housing right-side up and not upside-down, (b) getting each wire into the correct location in the four-position bus plug, and (c) stripping and tinning the open wire ends so that they may be reliably inserted into the solderless breadboards.
Step 1a: Inserting a Crimped Wire into the Jack Housing. The figure below shows top and end views of the crimped wire and a 2position housing. Notice the tiny locking leaf on the edge of the connector "U". This leaf should be visible through a slot in the plug when it is inserted. Look at the AFTER INSERTION drawing specifically. Notice that you can see the locking leaf through a slot in the plug.
Step 1b: Inserting the Ground and Bus Signal Wires. The photograph shown below (enlarged for clarity) shows the correct position of the black ground and white bus signal wires in the 4position bus plug. The bus plug is held so that the locking leafs can show through. From left to right, with the wires coming in from the bottom, the order is: black wire, empty slot, white wire, empty slot.
Step 1c: Stripping and Tinning the Wires. This step prepares the wires for reliable insertion into the solderless breadboards. Strip about 1/3 of an inch (about 0.5 cm) of insulation from the ends of the wires. Then twist each wire end (individually) into a tight braid. Then apply solder to the exposed braid, letting it infuse into the tiny wire strands, making a solid single bundle. Clip any excess solder ball from the end of the wire.
The cable is now ready to use! Insert the plug the into the Handy Cricket bus jack. Insert the black wire a ground in your LogoChip circuit. Insert the white wire into Port B0 (pin 21) of the LogoChip.
Step 2: Send a Command Word from the Handy Cricket. We will choose device class ID of $80 (decimal 128) for our example. So the Handy Cricket needs to send $80 marked as a command word to the LogoChip slave. It does this by sending $100 plus $80 or $180.
For demonstration purposes, put the command bsend $180 beep into the Run This line of the Handy Cricket, and download. Now each time you press the Cricket's Run/Stop button, it will send the command word $80 and beep.
Step 3: Receive the Command Word from LogoChip. The LogoChip should wait until a word comes in on the bus, and then check it to see if it's the magic code $180 (i.e., the value $80 marked as a command). If so, it will flash.
Code to do this is:
to slave waituntil [newbus?] if brcv = $180 [flash] slave end
Run this code on LogoChip. Now, press the button on the Handy Cricket. LogoChip should flash!
Your TurnYou now have the tools required to create your own LogoChip-based bus slave. For more information about typical protocols, see the documentation for the LED Number Display and the Handy Cricket Bus Overview.
Doing Serial with the LogoChip
To send a byte out the LogoChip's TxD pin, use the built-in keyword send .
Use the procedures below for serial receive:
to receive? output $20 and read $c end to getchar output read $1a end
The receive? procedure returns true if a serial char is waiting.
The getchar procedure returns the waiting char. getchar blocks if no character is available.
Changing Baud Rate
Two registers control the baud rate: SPBRG (address $99) and another reg at $98.
To switch to 9600 baud, execute:
setbit 2 $98
This puts the PIC into high speed mode, and the default setting in the baud rate register (which happens to be 129 decimal) is good for 9600 baud.
Note that the LogoChip will revert to 2400 baud between each command entered at the control center.
Main LogoChip SiteHere is the main site for LogoChip.
Last modified: Tuesday, 03-May-2005 12:17:31 EDT email@example.com