PDA

View Full Version : Cant see where im going wrong with 16f1937



gti_uk
- 20th February 2012, 21:45
Hi,
Ive been messing with Pic Basic pro on off for a while and have now found a good project to make, ive done the project fine on a 16f877a and it works fine in theory (although its short a few pwm channels). So ive got a 16f1937 which has enought ports and i was going to move my code over to it and finish it off.
As it was a new chip i thought i would just test first by doing a simple blinky light style app, but thats where the problem started. No matter what i do i cannot get any life out of the chip. Im using 2.6c and MPLab 8.83.


' Note: Open the 16F1934.INC file in your PBP directory, and comment out the default with ;
' __config settings.
ASM
__config _CONFIG1, _FOSC_XT & _WDTE_SWDTEN & _PWRTE_ON & _MCLRE_ON & _BOREN_ON & _IESO_ON & _FCMEN_ON
__config _CONFIG2, _PLLEN_OFF & _LVP_OFF & _VCAPEN_OFF & _STVREN_ON & _BORV_25
ENDASM
DEFINE OSC 4 'Set osc
OPTION_REG = %00000101
ANSELA = %00000000 ' PORTA ANALOG SELECT REGISTER
ANSELB = %00000000 ' PORTB ANALOG SELECT REGISTER
'Setup ports
TRISA = %00000000 ' Set PORTA
TRISB = %00000000 ' Set PORTB
TRISC = %00000000 ' Set PORTC
TRISD = %00000000 ' Set PORTD

Pause 500 ' Wait for LCD to startup
Main:
PortA.0 = 1
PortB.0 = 1
PortC.0 = 1
PortD.0 = 1
Pause 500
PortA.0 = 0
PortB.0 = 0
PortC.0 = 0
PortD.0 = 0
Pause 500
GOTO Main


Ive tried it with the default config settings and wiht the ones below but not sure why i cannot get it to do anything, ive had no issue with programming the 877a and ive even tried a different 1937 chip incase. Ive double checked and MPLab is showing a 1937 as the device.

The board im using is a QL200 which as worked fine with the 877a and im using a ICD2 usb clone.

Does anyone have any pointers as to where i could be going wrong?

Thanks

Trev

BH_epuk
- 20th February 2012, 21:56
Hi

I used the 16F1936 a while back, from memory there were a few more things to set up, OSCCON register for example.
For some reason the code is not on this PC, I'll have a look when i get to work in the morning and see what i can dig out.

gti_uk
- 21st February 2012, 18:21
Hi BH_epuk

Thanks for the reply, ive just tried setting the OSCCON reg to use an external 4mhz crystal with pll off (trying to keep things simple and build from there) and still no joy, guess there must be another register im not setting right also.

Thanks again

Trev

gti_uk
- 25th February 2012, 16:42
Hi all again

Still having no luck, ive tried setting it to use the internal osc with no luck and ive even tried a pic 16f1936 which acts the same. I did suspect my ICD2 but i tried my old trusty 877a and it worked fine as expected. I even tried setting all the reg's for stuff like adc ect to off and still no joy with the 1936.

Has anyone got any pointers?

Thanks

Trev