PDA

View Full Version : Pic12f615 Hpwm???



WireMan
- 9th November 2007, 20:08
I'm new at this and I'm totally confused.
I have PBP 2.5 and Microcode Studio Plus. All I want to do for now is get an LED to fade on and then off again using the HPWM. I have looked at examples on the forum and tried everything I can think of with the different registers and all I'm getting when I compile is a long list of errors saying "Symbol not previously defined(register name)".

The manual is no help and the datasheet doesn't do much better

Can someone explain this so it makes sense???

Thanks

mister_e
- 9th November 2007, 20:37
Probably because this pic don't have any built-in/Hardware PWM module (CCP)... to use HPWM you will need to switch to a 12F683, or use PWM, or create a timer interrupt.

WireMan
- 9th November 2007, 21:05
According to the datasheet it's on GPIO.2

Bruce
- 9th November 2007, 21:19
Place these defines in the top section of your code;

DEFINE CCP1_REG GPIO
DEFINE CCP1_BIT 2

Should compile & work fine now.

WireMan
- 9th November 2007, 21:29
It's still giving me a series of the same errors... I'm so confused!

mister_e
- 9th November 2007, 21:35
oups, i think i didn't check the right datasheet... :o

something is weird in the CCP1_REG and in CCP1_BIT declaration... So try to add the following defines


DEFINE CCP1_REG GPIO 'Hpwm 1 pin port
DEFINE CCP1_BIT 2 'Hpwm 1 pin bit

EDIT: OUPS again... Bruce beat me. So now, what are those errors ??? Which version are you using?

Bruce
- 9th November 2007, 21:39
If you're using MPASMWIN as the assembler, make sure you have the latest version of
MPLAB installed with the P12F615.INC header file.

You could also try switching to PM as the assembler for a quick check.

If you upgraded from an older version of PBP that may be a problem too if MCS is still using
the old version at compile time. Support for the 12F615 was added in version 2.50.

WireMan
- 9th November 2007, 21:45
I have v. 2.5

I must be missing something... Those defines look the same as the ones above????

Error[113]c:\pbp\pbppic14.lib 1972 : Symbol not previously defined(registername)

mister_e
- 9th November 2007, 21:55
mmm, how about your code? so we can check it here as well.

<hr>

For the other members, you can fix this little problem and modify the 12F615.BAS file located in your PBP folder. Just open it and add the line in RED



BANK0 $0040, $007F
LIBRARY "PBPPIC14"
DEFINE CCP1_REG GPIO
DEFINE CCP1_BIT 2

include "PIC14EXT.BAS"

PORTL VAR GPIO
PORTH VAR GPIO
TRISL VAR TRISIO
TRISH VAR TRISIO

include "PBPPIC14.RAM"

'*-----------------------* EOF 12F615.BAS *---------------------*

This will set the Default settings, and avoid to see that Warning [219] message again.

Thanks Charles from Melabs!

It doesn't explain error [113] of WireMan in the previous post... let's see it's code first

WireMan
- 11th November 2007, 00:36
Here is what I have.....

Duty var Word
DEFINE CCP1_REG GPIO
DEFINE CCP1_BIT 2

TRISIO = %00000000
T2CON = %00010101
PR2 = 249
Duty = 200

HPWM 1,duty,1000

End


On the [113] ERROR it references the following registers...
T2CON, PR2, CCPR1L, CCP1CON

Then there are two registers I don't see in the data sheet...
T2CKPS0 and T2CKPS1

I feel like I'm shooting in the dark here...

Bruce
- 11th November 2007, 01:47
Error 113 is an MPASM assembler error for Symbol not previously defined

This means you either don't have an updated version of MPLAB with the P12F615.INC, it's
bad, it's not being found because your path is not setup right, etc, etc,,.

Set PM as the assembler in MicroCode Studio. If it compiles OK, then you know what the
problem is, and can fix it.

WireMan
- 11th November 2007, 02:14
Bruce,

Thanks!!! For some reason the program got confused as to the path for the assembler. I directed it manually and it is working fine... compiled the first time with no errors!

Thank you to everyone who tried to help with this!!!

Pat