Lets back up a bit. We normally start with a blinky program. If you have already done this then great, if not....
The configs will need set for the hardware. This can be done int the *.inc file found in the PBP directory or in code space. This link tell about it.
http://www.picbasic.co.uk/forum/showthread.php?t=543
Being that you are starting, start using MPASM for the assembler. It will save you trouble later.
Start with the 16F877A.
By default the OSC in the *.inc is set for XT. This is fine if you have a crystal attached, if you have a resonator change it to HS.
Now for the code,
Code:
'16F877A
DEFINE OSC 4 ' This tells PBP how fast the chip is running.
'This line is the configs MPASAM style
'Comment it out if the configs are set in the *.inc
@ __config _HS_OSC & _WDT_OFF & _LVP_OFF & _CP_OFF &_BODEN_OFF
ADCON1=%00000111 ' Turns off the ADC
CMCON=%00000111 'Turns off the Comparators
TRISA = %00000000 ' Makes all pins on PORTA outputs
'Set up some variables.
LED VAR PORTA.1 'Attach a LED to PORTA pin 1
RUN: Make the LED blink at 1 sec on and 1 sec off
HIGH LED
PAUSE 1000
LOW LED
PAUSE 1000
GOTO RUN
END
The above will help you determine if the chip is running correctly.
Do the same for the 12F683.
The PBP default is internal OSC and the chip defaults to 4 MHz. So you should be good as long as PBP is told about it.
DEFINE OSC 4
In you code like we did for the 877A.
Get everything blinking as it should and then tackle the serial part.
Bookmarks