I can't seem to get PORTD and PORTE to operate on a PIC 16f59 chip. Below is a program to toggle all ports off and on. PORTA, PORTB, and PORTC work fine.
;Chip Settings
#chip 16F59, 4
#config CP=OFF, WDT=OFF, OSC=XT
DIR PORTA b'00000000'
DIR PORTB b'00000000'
DIR PORTC b'00000000'
DIR PORTD b'00000000'
DIR PORTE b'00000000'
Begin:
PORTA = b'11111111'
PORTB = b'11111111'
PORTC = b'11111111'
PORTD = b'11111111'
PORTE = b'11111111'
Wait 250 ms
PORTA = b'00000000'
PORTB = b'00000000'
PORTC = b'00000000'
PORTD = b'00000000'
PORTE = b'00000000'
Wait 250 ms
Goto Begin
I am using the latest build, 95.009. I wrote a C program with MPLAB and all ports worked fine.
Any suggestions would be helpful!
Thanks.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I can't imagine why it doesn't work here. I just loaded my C program from MPLAB and all ports work as expected. I deleted my old GCBasic, downloaded a fresh version, compiled the same file I listed here, and ports D and E do not work. I tried both a PICkit 2 and 3, same results.
I have programmed quite a few different chips and program combinations without any problems (Other than my many coding mistakes) , until this.
Again, any suggestions are welcome. And thank you for the quick response!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I have included the C source and dissassembly file for the working code from MPLAB-X using XC8 compiler. I don't see where MPLAB creates a .asm file, only the dissassembly file. I hope it helps.
Hugh and i have looked into this. Looks like the assembler was incorrectly setting a bit. Puzzled here why it works in the Simulator but not on the real chip. Ho hum. The did confuse me for a few minutes.
Please download this file core12.dat and place in your chipdata folder. Recompile, test and report back here with your results. :-)
Thanks
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
That did it!
I think I am near the limits of rewrites to the flash memory on this chip trying everything I could think of.
Thank you and Hugh so much for your help!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The NoBankRAM section in the chip data file sounds correct - it refers to the area of RAM that can be accessed regardless of which bank is currently selected. The 16F59 does have RAM from 0x0A to 0x1F in bank 0, but only 0x0A to 0x0F can be accessed while another bank is selected. If for example bank 3 is selected, the PIC would be working with addresses between 0x60 and 0x7F. Accessing 0x6A to 0x6F would map back to 0x0A to 0x0F, but accessing 0x70 would access location 0x70 (not 0x10).
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
;Chip Settings
#chip 16F59, 4
#config CP=OFF, WDT=OFF, OSC=XT
DIR PORTA b'00000000'
DIR PORTB b'00000000'
DIR PORTC b'00000000'
DIR PORTD b'00000000'
DIR PORTE b'00000000'
Begin:
PORTA = b'11111111'
PORTB = b'11111111'
PORTC = b'11111111'
PORTD = b'11111111'
PORTE = b'11111111'
Wait 250 ms
PORTA = b'00000000'
PORTB = b'00000000'
PORTC = b'00000000'
PORTD = b'00000000'
PORTE = b'00000000'
Wait 250 ms
Goto Begin
I am using the latest build, 95.009. I wrote a C program with MPLAB and all ports worked fine.
Any suggestions would be helpful!
Thanks.
Sorry works here ok. I used your code.
Porta - 4 LEDS on/off
Portb - 8 LEDS on/off
Portc - 8 LEDS on/off
Portd - 8 LEDS on/off
Porte - 4 LEDS on/off
I can't imagine why it doesn't work here. I just loaded my C program from MPLAB and all ports work as expected. I deleted my old GCBasic, downloaded a fresh version, compiled the same file I listed here, and ports D and E do not work. I tried both a PICkit 2 and 3, same results.
I have programmed quite a few different chips and program combinations without any problems (Other than my many coding mistakes) , until this.
Again, any suggestions are welcome. And thank you for the quick response!
Post your asm as an attachment. Let me have a look.
Here you go. I hope you find something in there.
Thank you..
Would you be able to post asm from working solution? I think I need it
And, what assember are you using?
I have included the C source and dissassembly file for the working code from MPLAB-X using XC8 compiler. I don't see where MPLAB creates a .asm file, only the dissassembly file. I hope it helps.
Hugh and i have looked into this. Looks like the assembler was incorrectly setting a bit. Puzzled here why it works in the Simulator but not on the real chip. Ho hum. The did confuse me for a few minutes.
Please download this file core12.dat and place in your chipdata folder. Recompile, test and report back here with your results. :-)
Thanks
That did it!
I think I am near the limits of rewrites to the flash memory on this chip trying everything I could think of.
Thank you and Hugh so much for your help!
We did think..... wow an old chip... why?
But, thank you letting us know and now everyone can be happy that the 16f59 works!
:-)
If I am reading the chipdat for the 16f59 correctly, the NoBankRAM should be 0A:1F, not 0A:0F.
Thanks again, guys.
Glad to help!
The NoBankRAM section in the chip data file sounds correct - it refers to the area of RAM that can be accessed regardless of which bank is currently selected. The 16F59 does have RAM from 0x0A to 0x1F in bank 0, but only 0x0A to 0x0F can be accessed while another bank is selected. If for example bank 3 is selected, the PIC would be working with addresses between 0x60 and 0x7F. Accessing 0x6A to 0x6F would map back to 0x0A to 0x0F, but accessing 0x70 would access location 0x70 (not 0x10).