My 1st Board of Edu. Project
mike_z
Posts: 4
My 1st· Board of Education looks some what like this.· See figure 1.
·
The idea is to build generic solutions to some interesting application that could be implement quickly and built on the way to some more advanced projects.· Parts of which are not well defined yet.· But some ideas are:· A cluster of Microprocessors on a – one/two/three-wire bus, RF networks, and Ethernet.··
·
I believe that one could build a distributed control system (even ‘bots) with a hand full of relative inexpensive set of chips and modules.
·
What I’ve learned:
·
1)····· That the BOE is a great platform for both learning and refreshing old micro processing skills.
2)····· Understand the peripheral I/O structure and ohms law (I = V/R) that applies to max current – i.e. sinking, sourcing, and max device power dissipation.
3)····· An old friend – “Basic” programming in a small work set.··
4)····· There lot’s to be done.
·
Code segment include on pg2.
·
Mdz
CR
pg - 2
PBASIC Test Code -
‘ {$STAMP BS2}
' {$PBASIC 2.5}
' BS2 Frame work w/main· - mdz 8/06
' LCD init & Line 1&2 message display - mdz 8/06
' Light Sensor test - mdz 8/06
'
'
' Display messages - text + terminator (less than 16 char if LCD disp)
Text1······ DATA· "Photo Sensor",255
Text2······ DATA· "Res =··· K ohms",255
Text3······ DATA· "··· ",255
Text4······ DATA· "··· ",255
' LCD Constants and varables
N9600······ CON·· $4054··· ' 9600 baud inverted
I·········· CON·· 254····· ' Instruction prefix value
CLR········ CON·· 1······· ' Clear screen instruction
LINE1······ CON·· 127····· ' Address of 1st charactor of line1 -1
LINE2······ CON·· 191····· ' Address of 1st charactor of line2 -1
row········ VAR·· Bit····· ' selects either Line1 or Line2 (0 or 1)
offset····· VAR·· Nib····· ' offset in to Line address
PORT······· CON·· 7······· ' Currently wired port number (P0 - P15)
index······ VAR·· Byte···· ' index in to text array
char······· VAR·· Byte···· ' char we send
text_num··· VAR·· Nib····· ' text message number (0-3)
' Progarm Constants and Varables
RCT········ VAR·· Word··· ' rc time value
RCT1······· VAR·· Word··· ' copy of rct (can't modify rct)
Pnum······· CON·· 2······ ' Pnum (P0 - P15) currently wired
R·········· VAR·· Word··· ' Resistence in K ohms
C·········· CON·· 1······ ' Cap in uF
'*******************************************
'init LCD Display
GOSUB init_LCD
'Send text1 to LCD Line1
text_num = 0
row = 0
GOSUB LCD_OUT
'Send text2 to LCD Line2
text_num = 1
row = 1
GOSUB LCD_OUT
'*******************************************
' main loop
MAIN:
GOSUB LS_TEST
PAUSE 1000
GOTO MAIN
STOP
'*******************************************
' Light sensor
' test code
LS_TEST:
HIGH Pnum··············· ' Discharge cap
PAUSE 1················· ' for 1 ms
RCTIME Pnum,1,RCT······· ' Measure (charge goes from 5 to 1.5) RC time while <> 1
·· IF rct > 0 THEN
····· rct1 = rct
·· ELSE
····· rct1 = $FFFF······ 'fix for timer timed out (time > $FFFF)
·· ENDIF
' R = RCTIME units / 600 * C in uf
r = rct1/600 * c· ' 1 = value of C in uF
SEROUT port,n9600,[noparse][[/noparse]I,Line2+7,"·· "]· '3 spaces 108 K max dec.
SEROUT port,n9600,[noparse][[/noparse]I,Line2+7,DEC r-20]
DEBUG DEC (110 - (r-20))· 'relative light intensity – work with StampPlot
RETURN
'*******************************************
' initilize LCD
init_LCD:
PAUSE 1000
·· SEROUT port,n9600,[noparse][[/noparse]I,CLR]
RETURN
'*******************************************
' Send text message to Line1 or Line2 - text_num points to the outstring
' and row is either 0 or 1 (LCD line1 or line2)
LCD_OUT:
LOOKUP text_num,[noparse][[/noparse]Text1,Text2,Text3,Text4],index
SendIt:
READ index, char
·· IF char = 255 THEN GOTO Done
index = index + 1······ ' index to charactor in text_n
offset = offset + 1···· ' line address offset
PAUSE 100
BRANCH row,[noparse][[/noparse]Case0, Case1]
·· Case0:
·· SEROUT port,n9600,[noparse][[/noparse]I,Line1+offset]
·· SEROUT port,n9600,[noparse][[/noparse]char]
·· GOTO SendIt
·· Case1:
·· SEROUT port,n9600,[noparse][[/noparse]I,Line2+offset]
·· SEROUT port,n9600,[noparse][[/noparse]char]
·· GOTO SendIt
DONE:
·· offset = 0
RETURN
STOP
Post Edited (mike_z) : 8/28/2006 5:42:18 AM GMT
·
The idea is to build generic solutions to some interesting application that could be implement quickly and built on the way to some more advanced projects.· Parts of which are not well defined yet.· But some ideas are:· A cluster of Microprocessors on a – one/two/three-wire bus, RF networks, and Ethernet.··
·
I believe that one could build a distributed control system (even ‘bots) with a hand full of relative inexpensive set of chips and modules.
·
What I’ve learned:
·
1)····· That the BOE is a great platform for both learning and refreshing old micro processing skills.
2)····· Understand the peripheral I/O structure and ohms law (I = V/R) that applies to max current – i.e. sinking, sourcing, and max device power dissipation.
3)····· An old friend – “Basic” programming in a small work set.··
4)····· There lot’s to be done.
·
Code segment include on pg2.
·
Mdz
CR
pg - 2
PBASIC Test Code -
‘ {$STAMP BS2}
' {$PBASIC 2.5}
' BS2 Frame work w/main· - mdz 8/06
' LCD init & Line 1&2 message display - mdz 8/06
' Light Sensor test - mdz 8/06
'
'
' Display messages - text + terminator (less than 16 char if LCD disp)
Text1······ DATA· "Photo Sensor",255
Text2······ DATA· "Res =··· K ohms",255
Text3······ DATA· "··· ",255
Text4······ DATA· "··· ",255
' LCD Constants and varables
N9600······ CON·· $4054··· ' 9600 baud inverted
I·········· CON·· 254····· ' Instruction prefix value
CLR········ CON·· 1······· ' Clear screen instruction
LINE1······ CON·· 127····· ' Address of 1st charactor of line1 -1
LINE2······ CON·· 191····· ' Address of 1st charactor of line2 -1
row········ VAR·· Bit····· ' selects either Line1 or Line2 (0 or 1)
offset····· VAR·· Nib····· ' offset in to Line address
PORT······· CON·· 7······· ' Currently wired port number (P0 - P15)
index······ VAR·· Byte···· ' index in to text array
char······· VAR·· Byte···· ' char we send
text_num··· VAR·· Nib····· ' text message number (0-3)
' Progarm Constants and Varables
RCT········ VAR·· Word··· ' rc time value
RCT1······· VAR·· Word··· ' copy of rct (can't modify rct)
Pnum······· CON·· 2······ ' Pnum (P0 - P15) currently wired
R·········· VAR·· Word··· ' Resistence in K ohms
C·········· CON·· 1······ ' Cap in uF
'*******************************************
'init LCD Display
GOSUB init_LCD
'Send text1 to LCD Line1
text_num = 0
row = 0
GOSUB LCD_OUT
'Send text2 to LCD Line2
text_num = 1
row = 1
GOSUB LCD_OUT
'*******************************************
' main loop
MAIN:
GOSUB LS_TEST
PAUSE 1000
GOTO MAIN
STOP
'*******************************************
' Light sensor
' test code
LS_TEST:
HIGH Pnum··············· ' Discharge cap
PAUSE 1················· ' for 1 ms
RCTIME Pnum,1,RCT······· ' Measure (charge goes from 5 to 1.5) RC time while <> 1
·· IF rct > 0 THEN
····· rct1 = rct
·· ELSE
····· rct1 = $FFFF······ 'fix for timer timed out (time > $FFFF)
·· ENDIF
' R = RCTIME units / 600 * C in uf
r = rct1/600 * c· ' 1 = value of C in uF
SEROUT port,n9600,[noparse][[/noparse]I,Line2+7,"·· "]· '3 spaces 108 K max dec.
SEROUT port,n9600,[noparse][[/noparse]I,Line2+7,DEC r-20]
DEBUG DEC (110 - (r-20))· 'relative light intensity – work with StampPlot
RETURN
'*******************************************
' initilize LCD
init_LCD:
PAUSE 1000
·· SEROUT port,n9600,[noparse][[/noparse]I,CLR]
RETURN
'*******************************************
' Send text message to Line1 or Line2 - text_num points to the outstring
' and row is either 0 or 1 (LCD line1 or line2)
LCD_OUT:
LOOKUP text_num,[noparse][[/noparse]Text1,Text2,Text3,Text4],index
SendIt:
READ index, char
·· IF char = 255 THEN GOTO Done
index = index + 1······ ' index to charactor in text_n
offset = offset + 1···· ' line address offset
PAUSE 100
BRANCH row,[noparse][[/noparse]Case0, Case1]
·· Case0:
·· SEROUT port,n9600,[noparse][[/noparse]I,Line1+offset]
·· SEROUT port,n9600,[noparse][[/noparse]char]
·· GOTO SendIt
·· Case1:
·· SEROUT port,n9600,[noparse][[/noparse]I,Line2+offset]
·· SEROUT port,n9600,[noparse][[/noparse]char]
·· GOTO SendIt
DONE:
·· offset = 0
RETURN
STOP
Post Edited (mike_z) : 8/28/2006 5:42:18 AM GMT