no way to compare when less than two revisions
Differences
This shows you the differences between two versions of the page.
— | atmel:relaycontrollersource [2009/11/27 17:53] (current) – created - external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | <code vb> | ||
+ | ' | ||
+ | '* Port flipper | ||
+ | '* | ||
+ | '* Each port in the PORT array will be toggled HIGH/LOW and held for | ||
+ | '* a second - Useful for debugging. | ||
+ | '* | ||
+ | '* uP: AT89S8313 | ||
+ | '* Language: | ||
+ | '* Date: 2005.Feb.27 | ||
+ | '* Version: | ||
+ | '* Author: | ||
+ | ' | ||
+ | $regfile = " | ||
+ | $crystal = 8000000 | ||
+ | Dim Port(4) As Byte | ||
+ | Dim Currentport As Byte | ||
+ | Dim I As Byte | ||
+ | Dim J As Byte | ||
+ | |||
+ | Declare Sub Lcdlocation(byval Row As Byte , Byval Col As Byte) | ||
+ | |||
+ | ' Set all Relays OFF | ||
+ | Port(1) = 2 : Port(2) = 3 : Port(3) = 4 : Port(4) = 7 | ||
+ | For I = 1 To 4 | ||
+ | Set Portb.port(i) | ||
+ | Next I | ||
+ | |||
+ | ' | ||
+ | 'LCD runs at 9600 baud | ||
+ | Config Portb = Output | ||
+ | Open " | ||
+ | |||
+ | 'LCD Reset pin is driven from PortB.5 | ||
+ | Reset Portb.5 | ||
+ | Waitms 400 | ||
+ | Set Portb.5 | ||
+ | Waitms 400 | ||
+ | |||
+ | Currentport = 0 | ||
+ | Do | ||
+ | For J = 1 To 4 ' For each PORT | ||
+ | |||
+ | If Currentport <> 0 Then ' | ||
+ | Set Portb.currentport | ||
+ | End If | ||
+ | |||
+ | | ||
+ | Reset Portb.currentport | ||
+ | |||
+ | Call Lcdlocation(0 , 0) | ||
+ | Print #2 , " | ||
+ | |||
+ | For I = 1 To 4 ' | ||
+ | Call Lcdlocation(i , 0) | ||
+ | Print #2 , "Port: " ; Port(i) ; " = " ; Portb.port(i) ; | ||
+ | Next I | ||
+ | | ||
+ | Next J | ||
+ | Loop | ||
+ | |||
+ | Sub Lcdlocation(byval Row As Byte , Byval Col As Byte) | ||
+ | Col = Col + 32 | ||
+ | Row = Row + 32 | ||
+ | Print #2 , " | ||
+ | End Sub | ||
+ | </ | ||
+ | {{tag> |