PDA

View Full Version : DATA statements with PIC16F88



BrianT
- 29th July 2009, 02:34
I am using PBP2.50c with MCSP 3.0.0.5 with MPASM 5.03. The target PIC is the 16F88.

I always try and store the latest program revision number in the first 50 or so bytes of EEROM and display this on startup. It works a treat with 18F4620 which is my main PIC chip.

I now find code that works fine on the 18F4620 will not work at all on the 16F88.

The following code should output repeatedly two different lines of text. The first should be the data stored in EEROM locations 0 to 54 and the second line should be "This is a test of the TouchPad serial output".

All I get is the second line with the software revision line being just a string of blank or unprintable characters.

Are there any special requirements for the DATA statement with a PIC16F88?

<code>
data @0, 13, 10, "TouchPad v0.00 26 July 2009 ", 13, 10

' Device = PIC16F88
' Programmed with MeLabs Serial (USB) programmer.
' Configuration set to:-
' IntRC(IntIO2), WDT_OFF, PWRT_ON, MCLR_ON, BOR_ON, LVP_OFF,
' Flash Pgm Mem Write_ON, CCP multiplexed with RB0, CODE not protected
' Data EEPROM not protected, Fail safe clock monitor disabled,
' Int/Ext switch over disabled


DEFINE OSC 8
DEFINE DEBUG_REG PORTA 'Debug pin port
DEFINE DEBUG_BIT 0 'Debug output pin bit
DEFINE DEBUG_BAUD 19200 'Debug baud rate
DEFINE DEBUG_MODE 0 'Debug mode: 0 = True, 1 = Inverted
DEFINE DEBUGIN_REG PORTB 'Debugin pin port
DEFINE DEBUGIN_BIT 3 'Debugin pin bit
DEFINE DEBUGIN_MODE 0 'Debugin mode: 0 = True, 1 = Inverted
define Char_Pacing 2000


'************************* Variable allocation *******************
A var byte
B var byte

'************************* initialise *******************************
Initialise:
ANSEL = %00000000 ' set all pins to digital
TRISA = %00000000 ' all outputs
TRISB = %01111110 ' mixed I/O
CMCON = %00000111 ' comparators OFF
OSCCON = %01110000 ' select 8 MHz
' OSCTUNE = %00100000 'minimum freq
' OSCTUNE = %00011111 'maximum freq
OSCTUNE = %00001011 'experiment to give exactly 20 uSec high period.

'SetOscTune:
' porta.0 = 1
' pauseus 20 'Scoped with Tektronix digital CRO for 20.0 uS
' porta.0 = 0
' pauseus 50
' goto setosctune

ShowRevision:
for a = 0 to 53
read a,b 'read first 54 locations in EEROM
debug b 'display EEROM contents
next a
pause 1000
debug 13, 10, "This is a test of the TouchPad serial output", 13, 10
pause 1000

goto showrevision
</code>

BrianT
- 29th July 2009, 04:05
OOPS

I did not have options/more options/program data set to write the EEROM.

Silly me