PDA

View Full Version : Just can't get started



mikejp56
- 10th October 2015, 01:28
Hi All,
I am a brand newbie to PICs as far as software goes, but I have about 30 years experience on the hardware side. I am having a devil of a time just getting an LED to blink with a 16F887. The LED is connected to port D bit 0; pin 19. I am trying to run blinkx.pbp from the melabs website; http://melabs.com/samples/LABX1-16F887/blinkx.htm. I have MicroCode Studio 4 with PicBasicPro v2.6 compiler. Here is the code:

ANSEL = %00000000
ANSELH= %00000000
LED var Portd.0
mainloop:
High LED
pause 500

low led
pause 500

goto mainloop

end

This gives syntax errors on lines 11 and 12 (ANSEL and ANSELH), and a bad data type error on line 13 (LED var Portd.0). I am really buffaloed by these errors. As I said, this example came right off of the microEngineering labs website. Any help would be appreciated.
Thanks in advance.
Regards,
mike

Archangel
- 10th October 2015, 02:05
Compiles without issue for me.
Check to be SURE you have selected the correct PIC in Microcode studio, If that's not correct you will see those errors.

mikejp56
- 10th October 2015, 02:20
Hi Archangel,
I have the correct PIC selected. I was looking around at the menus, and inadvertently told it to find automatically the PBP compiler under View, Compile and Program Options. It reselected C:\pbp, so nothing has changed. But I still get these 3 compile errors. Any other ideas?
regards,
mike

Archangel
- 10th October 2015, 02:32
Hi Archangel,
I have the correct PIC selected. I was looking around at the menus, and inadvertently told it to find automatically the PBP compiler under View, Compile and Program Options. It reselected C:\pbp, so nothing has changed. But I still get these 3 compile errors. Any other ideas?
regards,
mike80668066
Sorry I copy pasted your code, see the image. Now if you select a chip WITHOUT ansel you will error out.

kenif
- 10th October 2015, 02:35
HIGH and LOW do not require any port setup. They set as output automatically, see the manual.
You don't need the ANSELs.

mikejp56
- 10th October 2015, 02:41
Hi Archangel and kenif,
I uninstalled MCS and PBP, and reinstalled both programs, and now it works.
Thanks for your time.
regards,
mike

towlerg
- 10th October 2015, 03:21
I have PBPX 3.0.7.1 and is compiles OK - an obvious mistake is to select 16F877 when you mean 16F887. Maybe the syntax is different in 2.6? Anyone with 2.6?

Among the more common things that got wrong (does not apply to your immediate problem) clock not running, incorrect setting of fuses and not turning off comparators. Suggest you have a look at anything by Darrel Taylor and in particular his ALLDIGITAL and FUSE CONFIGURATION programs.

George

HenrikOlsson
- 10th October 2015, 18:01
HIGH and LOW do not require any port setup. They set as output automatically, see the manual.
You don't need the ANSELs.

That is only partly correct!

HIGH/LOW manages the TRIS register for you but it does NOT manage ANSEL, CMCOM or any other registers which may prevent a digital pin from functioning as an output.

/Henrik.