Digital input and output

 

# Prototyping board (breadboard)
# Power supply connector
# 5-15VDC power supply
# Assorted wires
# 5V regulator
# PIC 18F452 or BX-24
# Serial cable
# DB9 female serial connector & headers
# 4MHZ crystal for PIC
# 22pF capacitors for crystal
# LED's
# Switches
# 10Kohm resistors
# 220 ohm resistors


Microcontrollers: what they are, different types, levels.
Intro to PIC and PIC Programming
Digital input and output
Serial Output

Output - LED

code:

input portb.0
output portd.1

main:

if portb.0 = 1 then ' if the switch is closed on pin RB0
high portd.1 ' set pin RD1 high
else
law portd.1 ' set RD1 law
endif

goto main

Input - Serial out

code:

code:

input portb.0
output portd.1
output portc.6


main:

if portb.0 = 1 then ' if the switch is closed on pin RB0
High portd.1 ' set pin RD1 high
SEROUT2 portc.6, 16468,
["You are pressing the botton!", 13,10]

else

low portd.1 ' set RD1 low

endif

goto main