PDA

View Full Version : Can I use HSERIN/HSEROUT to talk to a PC and the MicroCode Loader bootloader?



modifyit
- 16th June 2005, 02:46
I've been trying to get my 877a to talk to the PC using a code snippet I found on this site from Mister_E. I am using MicroCode Studio Plus 2.46 and MicroLoader. Do I need to use software serial communications instead of hardware when using the bootloader?

Here is the code from Mister E I have been messing with:

' Serial data echo test
' =====================
'
' File name : Serial_echo_test.bas
' Company : Mister E
' Programmer : Steve Monfette
' Date : 16/01/2005
' Device : PIC16F877

' PIC setting & Programming mode
' -------------------------------
'
;@ __config _HS_OSC & _WDT_ON & _PWRTE_ON & _BODEN_ON & _LVP_OFF
' HS(20Mhz) oscillator
' Enable watch dog timer
' Enable power up timer
' Enable brown out detect
' Disable low voltage programming
DEFINE OSC 20 ' Use 20 MHZ oscillator

' Usart Settings
' --------------
'
' refer to datasheet section 10 for the following settings
'
DEFINE HSER_RCSTA 90h ' Enable Serial PORT
' Enable continuous receive
'
DEFINE HSER_TXSTA 24h ' Enable transmit
' High baud rate (BRGH=1)
'
DEFINE HSER_SPBRG 129 ' set USART to 9600 baud (when BRGH=1)
DEFINE HSER_CLROERR 1 ' Enable automatic overrun error

' Variable Definition
' -------------------
SerData var byte
testvar var byte

Start:
' Program begining/Main Loop
' ==========================
'
HSERIN [serdata]
hserout [serdata]
goto start

modifyit
- 16th June 2005, 02:56
Never mind I got it to work

I forgot to add:

DEFINE LOADER_USED 1

to the top of the code