INCLUDE "modedefs.bas"
define OSC 20
define HSER_TXSTA 20h ' enable the transmit register
define HSER_BAUD 31250 ' set the baud rate
DEFINE ADC_BITS 10
DEFINE ADC_CLOCK 3
DEFINE ADC_SAMPLEUS 10
tempo VAR WORD
TRISA = %11111111
ADCON1 = %10000010
TRISB = %11111111
output PORTC.0
output PORTC.1
output PORTC.2
output PORTC.3
pause 500
main:
high PORTC.0
gosub playNotes
low PORTC.0
high PORTC.1
gosub playNotes
low PORTC.1
high PORTC.2
gosub playNotes
low PORTC.2
high PORTC.3
gosub playNotes
low PORTC.3
goto main
playNotes:
if PORTB.7 = 1 then
hserout [$99, $40, $40]
else
hserout [$89, $40, $000]
endif
if PORTB.6 = 1 then
hserout [$99, $4C, $40]
else
hserout [$89, $4C, $000]
endif
if PORTB.5 = 1 then
hserout [$99, $50, $40]
else
hserout [$89, $50, $000]
endif
if PORTB.4 = 1 then
hserout [$99, $3C, $40]
else
hserout [$89, $3C, $000]
endif
pause 200
return