PDA

View Full Version : PIC16F1828, "Symbol not previously defined (CCPTMRS0)", need help!



rayzrocket
- 20th December 2013, 05:50
:confused: PIC16F1828 has register for assigning the Timer2's to CCP modules named: CCPTMRS0 (that's a zero at the end).
I'm trying to set it using:
CCPTMRS0 = %00000110

But this line is throwing these errors in compilation:
Error[113] c:\pbp\pbppi14e.lib 583: Symbol not previously defined (CCPTMRS0)
Error[113] c:\pbp\pbppi14e.lib 918: Symbol not previously defined (CCPTMRS0)

Does this have to do with which bank to find CCPTMRS0?

PIC16F1828 datasheet shows CCPTMRS0 in bank5.

I'm using PicBasicPro2.6c

Thanks in advance!

rayzrocket
- 20th December 2013, 06:02
The 16F1828.bas file contains only this:

BANK0 $0020, $007F
BANK1 $00A0, $00EF
BANK2 $0120, $016F
EEPROM $F000, $F0FF
LIBRARY "PBPPI14E"
DEFINE CODE_SIZE 4

include "PI14EEXT.BAS"

PORTL VAR PORTA
PORTH VAR PORTC
TRISL VAR TRISA
TRISH VAR TRISC

include "PBPPI14E.RAM"

rayzrocket
- 20th December 2013, 06:12
CCPTMRS = %00000110 doesn't throw a compiler error; and this register does not exist on the PIC16F1828 data sheet nor in the Errata.
(maybe it's a mistake where CCPTMRS0 should be CCPTMRS in the data sheet) ?

..trial and error...

Darrel Taylor
- 20th December 2013, 15:30
This error was fixed in PBP 3.0.0.0 (Aug 2011)
There is no patch for 2.60, but you can set the CCP registers directly instead of using HPWM.

rayzrocket
- 20th December 2013, 16:11
I am not using the PBP HPWM call, I am setting up the CCPs in PWM mode manually in the order the PIC16F1828 datasheet states,
I tried this code:

OSCCON = %11101000 '4Mhz intosc
Define OSC 4 'software timers indicated for 4mhz operation
TRISA = %00011011'Tris register 1=input(PORdefault) 0=output
TRISB = %00110000'No Vref's used on ADC
TRISC = %10000111
ANSELA = %00010011'Ansel register 1=analog 0=digital
ANSELB = %00010000
ANSELC = %10000111
CCPTMRS0 = %00000110'Timer2/4/6 assignment to CCP modules(pulsed output pins)
'
Start:
TRISC.3=1 'Disable pin output, set as input
PR4=200 'Set Period Rate, PRx, in Timer
CCP2CON=%00001111 'Turn on PWM
CCP2CON.5=1 'high bit of 2LSBs of Duty
CCP2CON.4=0 'low bit of 2LSBs of Duty
CCPR2L=180 '8MSBs of Duty
PIR3.1=0 'clear Timer interrupt flag
T4CON.1=1 'high bit of 2bit Timer Prescaler
T4CON.0=1 'low bit of 2bit Timer Prescaler
T4CON.2=1 'Timer On
TRISC.3=0 'Enable pin output

the compiler throws this error:
Error[113] c:\pbp\pbppi14e.lib 583: Symbol not previously defined (CCPTMRS0)
Error[113] c:\pbp\pbppi14e.lib 918: Symbol not previously defined (CCPTMRS0)

rayzrocket
- 20th December 2013, 16:26
MOVE?CB 006h, CCPTMRS0
is put into the .asm file eventhough the error is shown in Microcode Studio

(I don't even know why I'm telling you this, but I figured it may help)

rayzrocket
- 20th December 2013, 16:30
Can you please give me some code to use for loading a value into CCPTMRS0 manually on the PIC16F1828.
The data sheet shows its in memory map location:
Bank5
29Eh
CCPTMRS0

Thanks in Advance!... And I'm working on purchasing PBP3.0 as well.

HenrikOlsson
- 20th December 2013, 19:24
Hi,
I'm not sure this is the case but I think it might be an MPASM include file issue.
It looks like CCPTMRS and CCPTMRS0 registers are one and the same (they are defined that way (at 0x029E) in my version (5.47) of the MPASM .inc file) so it's possible that your version of the .inc file is missing the CCPTMRS0 regsiter definition.

So, try using CCPTMRS instead of CCPTMRS0 or you can try adding...

ASM
CCPTMRS0 EQU H'029E'
ENDASM
...at the very beginning of your code.

/Henrik.

rayzrocket
- 20th December 2013, 20:28
DT is correct, after trying several variants of ASM code that didn't work; I was buying and downloading the PBP3.0.
The PBP3.0 is nicely packaged! Download the 128Mb flavor with all the new MPASM/Microcode Studio stuff...and you may need to get the latest Beta programmer software for newer PICs.
The multiple hardware PWMs on the PIC work from the multiple Timer2's now that I used PBP3.0
$$ well spent, and for a good cause to keep the PB biz going!

I still have a problem with keeping the hardware PWM going, it stops when I use HSER or ADC on other pins, eventhough the hardware PWM is coming out of a default ccp pin(that is not eusart by default)
..I haven't figured it out yet..

thanks all !!:)

rayzrocket
- 20th December 2013, 21:52
Ok, the hardest problems are the one's when you are the problem yourself.
I had an error in a supporting device's code, fixed it, and now all works good.
BUT,
It would not be possible without using the PBP3.0
thanks DT !

rayzrocket
- 21st December 2013, 18:48
Thank you Olsson!!, that work-around is on the right track and I tried a few attempts as such, but no success.
The PBP3.0 works good and worth the $$ IMO.

all the best!