PDA

View Full Version : SEROUT2 on PIC18F2620



MisterT
- 14th January 2011, 19:21
I have just spent 2 days trying to get a very simple program to run, to no avail.
I have modified the sample program BLINK to include a SEROUT2 instruction.
At first it runs ok.
If I then put an ARRAYWRITE before it, the program crashes.
I remove the ARRAYWRITE and the program runs, but there is no serial output. The LED pin toggles ok "around the SEROUT2 instruction", but the serout data pin does not change state.
The SEROUT2 takes up about 1mS (measured with a 'scope on the LED pin).
This is about right for 9600 baud. So it looks like the SEROUT2 code is running round its loops but not driving the data pin.

I am using the internal osc, set to 32MHz.

I have tried completely re-installing PBP and all files from the original installation disk, in case I had corrupted something. But still the problem persists.

Any ideas, please?
Thanks
:confused:

ScaleRobotics
- 14th January 2011, 19:41
Try turning _XINST_ON_4L to _XINST_OFF_4L

_XINST_OFF_4L EQU H'BF' ; Instruction set extension and Indexed Addressing mode disabled (Legacy mode)

We have to use "legacy" for PBP, it cannot use the extended instruction set (yet).

MisterT
- 15th January 2011, 09:53
Many thanks scalerobotics

I did as you suggest and also had to remove the line Define USE_LFSR 1
I now get serial output on my chosen pin.
I can do ARRAYWRITE and everything works.

Regards

MisterT