LogoChip Bus Communications

Group members: Adrien Grise and Thomas Kneeland

Document Author: Adrien Grise

Date: February 26, 2003

Synopsis: Using current project code and circuitry work, utilize the LogoChip’s bus to either transmit and/or receive data from another device such as a HandyCricket.  See lab assignment #5’s documentation for more information.

Description of Project

Goal

Issues

Possible Extensions

Circuit Diagram

LogoChip Code

HandyCricket Code

Contributions

 

Description of Project

Our current project revolves around the use of the 5x7 LED display chip.  Previous experimentation allowed us to build a simple circuit connecting the LogoChip to the 5x7 LED’s inputs and having the LogoChip display an alphanumeric character utilizing a subset of the 35 LEDs in the 5x7 LED chip.  For this assignment, we now utilize the B0 port as a bus between the LogoChip (the slave) and the HandyCricket (the master).  The HandyCricket will send a command message followed by a data message that will instruct the LogoChip to display a character on the 5x7 LED.  The LogoChip displays the character by outputting lines 1 through 7 that will make up the character, quickly flashing each one once on the 5x7 LED.  If flashed quickly enough and successively, the character will look steady as if all 7 lines were being displayed at one time.

 

Goal

We must attempt to build as simple a circuit as possible without damaging any of the circuitry involved.  The 5x7 LED requires less than 5 volts, the power output by the LogoChip, so care must be taken to ensure the individual LEDs of the 5x7 LED are not blown out.  A bus cable must be built and plugged in to both the LogoChip’s B0 pin and the XMIT pin of the HandyCricket.  Finally, a series of character maps must be developed that will instruct what LEDs should be lit for a particular character.

 

Issues

§         Initially we powered the 5x7 LED with just +5 volts and, in turn, blew out one of the 35 LEDs on the 5x7 LED chip.  We originally tried a voltage divider circuit, but found that this was too costly in terms of breadboard space, resistors, wiring, and time.  We next attempted to use a resistor between each LED pin and its corresponding LogoChip pin.  While this worked, we found that the voltage either too high or too low when all 35 LEDs in the display we attempted to be lit up.  Next we tried utilize transistors, but again found the voltages were incorrect to properly power the LEDs as we had wired it.  We finally resolved the situation by quickly flashing a single row of the LEDs one at a time for a short duration with no transistors, resistors, or voltage dividers between the LED and LogoChip pins.  This seems to successfully provide enough power to the LED but in short enough duration so as to not burn it out either.

§         We then found that when displaying each of the seven lines of a character map in quick succession, the LED was incapable of clearly displaying the character – the lines “bled” into each other.   We staggered the lines being displayed by the LogoChip so successive rows were not display immediately after each other allowing the signals to dissipate from the pins before sending a new signal. 

§         However, even after staggering the line displays, we still found the lines to “bleed”.  We next determined that we needed a small unit of time between when one line was displayed until when the next line was displayed.  While 1 second was too long a time, if no delay was inserted, we found the lines continued to “bleed” into each other.  To solve this we inserted a dummy repeat loop and experimented with the number of times to loop to have a properly displayed character on the 5x7 LED display.

§         We had hoped to utilize an array data structure to store the character maps, but were disappointed to find that LogoChip Logo does not currently support arrays.  A work-around was provided by after we had developed another work-around to display the character maps.  We did not re-visit the array work-around provided due to time constraints.

 

Possible Extensions

Instead of simple character maps flashing to the LED display, simple animations could be done to either morph 1 character into another or just to provide interesting, yet simplistic graphical animations.  Due to time constraints, neither of these ideas was developed, but it would simply be a case of having a series of character maps available, flashing each to the LED display briefly, and then displaying the next character map in quick succession.

 

Return to top.

 

Circuit Diagram

The following is a circuit diagram that illustrates how the HandyCricket, LogoChip, and UML Development Board are wired together for this project.

 

Return to top.

 

LogoChip Code

;
;   * * *      14 0E
; *       *    17 21
; *       *    17 21
; * * * * *    31 2f
; *       *    17 21
; *       *    17 21
; *       *    17 21
;

;to init
; Character A
;  aset characters 0 14
;  aset characters 1 17
;  aset characters 2 17
;  aset characters 3 31
;  aset characters 4 17
;  aset characters 5 17
;  aset characters 6 17
; Character B
;  aset characters 7 30
;  aset characters 8 17
;  aset characters 9 18
;  aset characters 10 31
;  aset characters 11 18
;  aset characters 12 17
;  aset characters 13 30
; Character C
;  aset characters 14 15
;  aset characters 15 16
;  aset characters 16 16
;  aset characters 17 16
;  aset characters 18 16
;  aset characters 19 16
;  aset characters 20 15
;end

global [cat curr_char command_chk]


constants [[portb 6][portb-ddr $86][porta 5][porta-ddr $85]]

to display_generic :b1 :b2 :b3 :b4 :b5 :b6 :b7
  ; 1st Row
  write portb $FE
  clearbit 1 portb
  write porta :b1
  repeat 32 [ setcat 1 ]
  ;wait 1
 
  ; 4th Row
  write portb $FE
  clearbit 4 portb
  write porta :b4
  repeat 32 [ setcat 1 ]
  ;wait 1

  ; 2nd Row
  write portb $FE
  clearbit 2 portb
  write porta :b2
  repeat 32 [ setcat 1 ]
  ;wait 1

  ; 5th Row
  write portb $FE
  clearbit 5 portb
  write porta :b5
  repeat 32 [ setcat 1 ]
  ;wait 1

  ; 3rd Row
  write portb $FE
  clearbit 3 portb
  write porta :b3
  repeat 32 [ setcat 1 ]
  ;wait 1

  ; 6th Row
  write portb $FE
  clearbit 6 portb
  write porta :b6
  repeat 32 [ setcat 1 ]
  ;wait 1

  ; 7th Row
  write portb $FE
  clearbit 7 portb
  write porta :b7
  repeat 32 [ setcat 1 ]
  ;wait 1

end

to display :character
  if :character = 65
    [display_generic $0E $21 $21 $2f $21 $21 $21]

  if :character = 0
    [display_generic $00 $00 $00 $00 $00 $00 $00]

  ; more if statements

end

to main

write portb-ddr $01
write porta-ddr $00
write portb $FE
write porta $00
setcommand_chk 1

loop [
    if newbus?
    [
       ifelse command_chk = 1
       [
          if brcv = $180
          [
             setcommand_chk 0
          ]
       ]
       [
          setcurr_char brcv
          setcommand_chk 1
       ]
    ]
    display curr_char
]
end

 

to test
loop [

write portb-ddr $00
write porta-ddr $00
write portb $FE
write porta $2F

]
end

 

Return to top.

 

HandyCricket Code

to main

  bsend $180

  wait 5

  bsend 65

  wait 20

  bsend $180

  wait 5

  bsend 0

  wait 20

  main

end

 

Return to top.

 

Contributions

As a partner of Thomas Kneeland, I assisted in the writing of the LogoChip and HandyCricket code.  I also assisted in the experimentation to find a suitable circuit layout that would properly connect and power the 5x7 LED chip from the LogoChip (see Issues).