Log in

View Full Version : Morse code reader compiles but won't run



VE7ZNU
- 6th April 2009, 17:47
We have a club project to read morse code from a speaker and display it on an LCD . The code compiles without error but won't run. I have used MPLBAsim but can't get it to work. It is coded for an 16F84 at 4 MHZ and a Hitachi LCD. Need some help. I have attached the code as text Morse2.txt

timmers
- 6th April 2009, 20:23
__CONFIG _CP_OFF & _WDT_OFF & _PWRTE_ON & _HS_OSC
; timing based on 1.12MHz RC oscillator configuration using 5.1Kohm + 100pf

Hi there,
Your first problem is you've defined a high speed oscillator but have an RC circuit connected instead.

Change your config line to

__CONFIG _CP_OFF & _WDT_OFF & _PWRTE_ON & _RC_OSC
; timing based on 1.12MHz RC oscillator configuration using 5.1Kohm + 100pf

For time critical applications a ceramic resonator or crystal is much more reliable. Dont forget the load capacitors for the crystal!

Tim.

VE7ZNU
- 6th April 2009, 20:49
I figured that I should get something out of the chip even with a 4MHZ xtal. But I guess it throws all the timing off, even for the LCD. I will make the appropriate changes and get back. I was suprised I couln't get it to run on MPLabSim. It wouldn't even click over 1 cycle. I am a newbie at MPLabSim so I may not have had it set up right. I get an error:
CORE-W0014: Halted due to PC incrementing over the Maximum PC address and wrapping back to Zero

timmers
- 6th April 2009, 22:07
Hmmm... gave up with Microchip machine code severeal years ago, -not easy to work with.

Its allways worth adding an LED to a spare pin, just to give a heartbeat confidence flash, to indicate its doing something.

Tim.