Thursday, July 07, 2005

Binary Reflects LED blinks, see binary through Serial


'0 = all LED is light OFF, 255 = all LED is light ON.


DEFINE ADC_BITS 10
DEFINE ADC_CLOCK 3
DEFINE ADC_SAMPLEUS 50

'x, holder name of place
x var byte
'zero var word
'one var word
'two var word
'three var word
'four var word
'five var word
'six var word
'seven var word
'turn those pin

'Set PORTB to all output
trisb = %00000000

pause 500
main:
'This line sets a random number between 0 - 255
for x = 0 to 255
portb = x
'send the random number to the ports in b line
pause 250
'adcin 0, zero 'send number of portb.0 to var zero
'adcin 1, one 'send number of portb.1 to var one
'adcin 2, two
'adcin 3, three
'adcin 4, four
'adcin 5, five
'adcin 6, six
'adcin 7, seven

'serout2 PORTC.6, 16468, [DEC zero, 13, 10]
'serout2 PORTC.6, 16468, [DEC one, 13, 10]
'serout2 PORTC.6, 16468, [DEC two, 13, 10]
'serout2 PORTC.6, 16468, [DEC three, 13, 10]
'serout2 PORTC.6, 16468, [DEC four, 13, 10]
'serout2 PORTC.6, 16468, [DEC five, 13, 10]
'serout2 PORTC.6, 16468, [DEC six, 13, 10]
'serout2 PORTC.6, 16468, [DEC seven, 13, 10]

serout2 PORTC.6, 16468, [DEC x, 13, 10]
' print it to serial out,
' with linefeed and carriage return (10, 13)

next
pause 750
goto main

0 Comments:

Post a Comment

<< Home