O.K. Let's try something first. A very simple test program test to send a text string to your PC via COM port. You'll use the MCS serial communicator (F4 then F9 to connect to the PORT)
Code:
'
' Hardware configuration
' ======================
@ __CONFIG _INTRC_OSC_NOCLKOUT & _WDT_OFF & _PWRTE_ON & _MCLRE_OFF & _LVP_OFF & _BODEN_ON
' Internal Oscillator
' Disable watch dog timer
' Enable power up timer
' Disable MCLR pin
' Disable low voltage programming
' Enable brown out detect
TRISB=0 ' PORTB : output to all i/o
'
' Hardware connection
' ===================
SerPin var PORTB.4 ' Serial data out connected via 1K resistor
' to PIN 2 of PC DB9 connector
' Don't forget the GND :o)
'
' Serial Communication definition
' ===============================
BAUD con 16780 ' 2400 Baud, Driven inverted, No Parity
'
' Software/Hardware initialisation
' ================================
serpin = 0 ' Set Serial data out to normal state
pause 100 ' safe settle time
'
' ////////////////////////////////|\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
'
' Program Start Here
'
' ////////////////////////////////|\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
'
START:
SEROUT2 SERPIN,BAUD,["PC COMMUNICATION TEST",13,10]
PAUSE 500
GOTO START
if you use PM as assembler, use the following config fuses OR set them manually.
Code:
'
' Hardware configuration
' ======================
asm
DEVICE PIC16F628, INTRC_OSC_NOCLKOUT ; Internal Oscillator
DEVICE PIC16F628, WDT_OFF ; Disable watch dog timer
DEVICE PIC16F628, PWRT_ON ; Enable power up timer
DEVICE PIC16F628, MCLR_OFF ; Disable MCLR pin
DEVICE PIC16F628, BOD_ON ; Enable brown out detect
DEVICE PIC16F628, LVP_OFF ; Disable low voltage programming
ENDASM
is the above work?
Bookmarks