t-edson / PicPas

Compilador en Pascal para microcontroladores PIC / Pascal compiler for PIC microcontrollers
GNU General Public License v2.0
88 stars 27 forks source link

Don't know if this is an issue...or me missing something. #64

Closed jtannenba closed 10 months ago

jtannenba commented 11 months ago

Altered the Hello World blink program for a pic16f886. When loaded with the pickit3, there is a warning that there are no configuration words in the hex file. Also program does not work. Program.txt

This is a copy of the program. I probably missed something easy. I used to use Turbo Pascal for work around 25 yrs ago and trying to come up to speed on microprocessors.

Am I correct in assuming it is ok to use a PicKit3?

t-edson commented 11 months ago

Hi. I'm afraid I haven't tested PicPas with PicKit. I don't touch the compiler for a long time, but I remember the hex file includes the Config Word if you use the directive $CONFIG:

{$CONFIG $3FFD}

{$define _CP_ON       =     0x000F}
{$define _CP_OFF      =     0x3FFF}
{$define _WDT_OFF     =     0x3FFB}
{$define _LP_OSC      =     0x3FFC}
{$define _XT_OSC      =     $3FFD}

{$CONFIG _CP_OFF, _XT_OSC, _WDT_OFF }

{$CONFIG _CP_OFF _XT_OSC _WDT_OFF }

Updating the PicPas compiler is in my TODO list.

jtannenba commented 11 months ago

I'll try that tomorrow. Thank you.

jtannenba commented 11 months ago

I added {$CONFIG $00EA} which should be HS, wdt on, Boren off and copy protect off. PicKit3 complains now the some config words are missing. On PicKit3, should be Config1 00EA and Config2 0700. Not sure about the second word which is the write protect. The program does not work either. The debug show it going, but the chip isn't going. I didn't do any $define statements, just the config statement. How do we define config reg2 (write protect bits) Looks like the defines are mask bits? I also noted the Configuration bits for a pic16f84 is way different from the pic16f886 that I am trying. The 886 has 2 config words to the 84's one? If I seem dense, please forgive me. My brain is 80 yrs old and not as functional as it was.

Edit: Don't have a PIC16F84, so tried a PIC16F628A which also has a 13 bit config and it works ok. Is there a Syntax guide? And, should it work on a PIC16F886? How do you add the 2nd Config word?

t-edson commented 10 months ago

Hi.

Edit: Don't have a PIC16F84, so tried a PIC16F628A which also has a 13 bit config and it works ok. Is there a Syntax guide? There is a user Manual and Technical Documentation in /Docs folder, only in Spanish by now. I think it should be easily translated with a translator online. And, should it work on a PIC16F886? It should. But maybe you can use some other PIC programmer hardware or some way to set the second config word. How do you add the 2nd Config word? Second config word is not implemented in the current version. I will put this requirement in the TODO list.

jtannenba commented 10 months ago

Thank you. I went to Google Translate and did the User's Manual. User Manual.pdf If you would like to include it in the docs.