Here is an LED flasher to test out a board I have.
You can modify the micro used, and the clock frequency used.
See if this will help to get you started.
Begin with just setting and resetting one port, not all of them.
Note that there are many ways (syntax) to set up the Ports and Pins.
JC
[code:1:a26f3494b6]
$regfile = "m32def.dat" 'Define Micro Used
$crystal = 14745600 'Xtal Freq
$hwstack = 64 'Hardware stack
$swstack = 64 'Software stack
$framesize = 64 'Frame space
Dim Uchb As Word 'uC Heart Beat, uC is running
Dim Fl As Byte 'Flash LED Loop Counter
Dim Lp As Byte 'Loop counter
Ledr Alias Portb.0 'LED Red (Reverse Logic)
Ledy Alias Portd.3 'LED Yellow
Ledg Alias Portd.4 'LED Green
Ledo Alias Portd.5 'LED Orange
Piezo Alias Portc.7 'Piezo Beeper
Oscope Alias Portd.2 'Config Header, used for Oscope
Pbsw1 Alias Pind.7 'Read a Pin
Pbsw2 Alias Pind.6 'Read a Pin
Premain:
'Start Up Delay
Waitms 100 '100 mSec
'Now Configure the Port's Pins for Input or Output mode.
'0 = Input, 1 = Output
Config Porta = &B00000000 'Port A, All Input, Default
Config Portb = &B00000001
Config Portc = &B10000001
Config Portd = &B00111110
Main:
Do
Set Ledr 'Red LED High = Off
Waitms 500
Reset Ledr
Waitms 500
Loop
[/code:1:a26f3494b6]
↧