Parts list
| 
Description | 
Part number | 
qty | 
Unit cost | 
| 
ATMega368P -16PU (32K 28pin) | 
1 | 
3.95 | |
| 
74HC595 shift register | 
4 | 
0.55 | |
| 
10mm red LED | 
16 | 
0.16 | |
| 
10mm green LED | 
16 | 
0.16 | |
| 
0.1" Pitch Single Row header strip (16 per
  module) | 
4 | 
0.30 | |
| 
0.1" Pitch Single interconnect (8 per module) | 
4 | 
0.30 | |
| 
2.2uf supply decoupling (1 per module) | 
4 | 
0.07 | |
| 
100uF Main decoupling | 
1 | 
0.18 | |
| 
FTDI USB-Serial converter 5V TTL level | 
1 | 
11.00 | |
| 
16Mhz X-tal | 
1 | ||
| 
100nf decoupling | 
2 | ||
| 
10K ohm 250mw (cold-starter) | 
1 | ||
9600 8 n 1
All command are intended for use over a
terminal with a person typing, and are human readable in ASCII. Hence a 10ms
character delay is needed if pasting commands into Hyperterminal (Teraterm) or
driving via application. A Windows Powershell sample test application to be
attached. Commands are terminated by a carriage-return pair (CR-LF.) I.e. enter
+ ctrl-enter. All input is echoed back to the sender making verification of
link easier. Additional information for debugging is attached to each activity,
so command responses are not currently machine process-able. Commands generally
follow a letter + value pair, all integer parameter values are in the range
0..255.
Example:
B:nnn
Set brightness 0=off, to 255 max (maximum
brightness is actually around 90, and depends on the PWM configuration of the
controller.)
| 
prefix | 
Value1 | 
Value2 | 
Meaning | 
| 
B | 
0..255 | 
- | 
Set brightness from 0..90 | 
| 
L | 
0..4 | 
0..255 | 
Send value2 to shift register value1. Sets the
  bitmask  | 
| 
S | 
0..31 | 
0,1,2,3 | 
Set lamp  
0=led off 
1=led on 
2=blinking (on/off) 
3=blinking (off-on) | 
| 
R | 
0..255 | 
- | 
Set blink rate , default=50 (50 is around 500ms) | 
| 
Q | 
- | 
- | 
Query device state, prints out some debug counters
  and clears the internal debug counters: 
1 – number of protocol errors??? 
2 - number of buffer overflows??? 
3 – buffer high-watermark | 
It is only possible to set LED behaviors
with the S command, blinking mode 3 blinks an LED in opposing phase to mode2.
https://engxd.domain.com/lemons/DesktopExt/auth/login.aspx
https://engxd.domain.com/lemons/DesktopExt/auth/login.aspx
Powershell Code
...
function Send-SerialMessage 
{
[cmdletbinding()]
param($port, $msg)
       $msgCR = "$msg`r`n"
       $msgCR[0..$msgCR.length]| %{
              $port.Write($_)
       }
       write-verbose $msgCR
}
function Read-SerialTrace
{
       $string = $port.ReadExisting() 
       while ($string -ne "") { $string| %{write-verbose "$portName: $_"};start-sleep -m 50 ;$string = $port.ReadExisting() }
}
...
# [System.IO.Ports.SerialPort]::getportnames()
       #$portName = "COM4"
       $port= new-Object System.IO.Ports.SerialPort $portName,9600,None,8,one
       write-verbose "Open port
$portName"
       Write-Progress -activity "Job : $label" -status "Open Display serial port
$portName" -percentcomplete 50
       $port.Open()
       $port.Handshake = "None"
       $port.ReadTimeout = 500
       # turn all leds off, from the back forwards
       Send-SerialMessage $port "B:3"    # lower brightness
       Send-SerialMessage $port "R:50"   # rate 50
       0..4 | % {
              Send-SerialMessage $port "L:$_,0"
       }
       Read-SerialTrace
...
And that's about it :-)
Comments
Post a Comment