PDA

View Full Version : Need help to shut off comparators for 16f688



jessey
- 24th October 2006, 06:07
Hello,

I'm trying to shut off the comparators on my 16f688 and can't seem to accomplish it, as a result I can't get RA0 or RA1 to function as expected. When I use CMCON0 = 7 or CMCON0 = %00000111 and try to compile, I get an error message saying there is a syntax error.

I'm using PicBasic Pro Ver 2.45, MPASM Ver 3.60 with MicroCode Studio 2.1.0.7 and EPIC Version 2.46 beta programmer with a PIC16F688-20/P.

Would anyone have any suggestions on why it won't compile? I looked at the data sheet and CMCON0 = %00000111 is a valid command and I've also seen this used in code examples while looking in the archives.

Any help would be very much appreciated.

Thanks
jessey

HenrikOlsson
- 24th October 2006, 06:30
Hi Jessy,

Do you have the right chip selected in MicroCodeStudio?

I believe you also need to clear the corresponding bits in the ANSEL register to make the pins digital.

/Henrik Olsson.

jessey
- 24th October 2006, 06:41
Hi Henrik,

Thanks for your reply. Yes I have selected the 16f688 in the MicroCode Studio drop down list and I'm also using ANSEL = %00000000.

Any other ideas?

Thanks
jessey

savnik
- 24th October 2006, 06:53
When I use CMCON0 = 7 or CMCON0 = %00000111 and try to compile
use : CMCON = 7

jessey
- 24th October 2006, 07:45
Hi savnik,

When I try and compile using CMCON = 7 I get an error saying 'Symbol not previously defined (CMCON)'. I checked the data sheet and the only reference it makes to CMCON is in a, Modified Comparator C1 Output Block Diagram in figure 7-4 and 7-5.

Thanks
jessey

Darrel Taylor
- 24th October 2006, 08:03
Hi Jessey,

I have both PBP 2.45 and 2.46

In 2.45 I get the same error you described. With 2.46 I don't.

But without upgrading, you might try

POKE $19, 7

HTH,

jessey
- 24th October 2006, 08:19
Hi Darrel,

That's great, it works like a charm now. I'll have to upgrade to the newest version. I'm in your debt once again.

Thanks a million
jessey

Darrel Taylor
- 24th October 2006, 10:49
No need to be in debt.

http://www.darreltaylor.com/files/WorkBeer.png

Darrel Taylor
- 25th October 2006, 23:25
Jessey,

I was just roaming the meLabs site, and it looks like the P245al.exe Patch might fix the missing register names for the 688.
http://www.melabs.com/support/patches.htm

Until you get a chance to upgrade :)

jessey
- 28th October 2006, 13:15
Hi Darrel,

Thanks for the tip. I just ordered the latest PBP upgrade v2.47 the other day and it should be here in a couple of days. I could have purchased an up-dated manual as well but the Canadian distributor I deal with didn't have any in stock. Is there an online updated version for PicBasic Pro that you know of?

I sure like the 16f688 micro, lots of nice features, inexpensive (I purchased 30 for under $100.00 CND) and it has twice the code space as the 16f628, that's cool!! I'm surprised I don't see more people here using them. What's your overall favorite microprocessor there Darrel?

Thanks
jessey

jessey
- 30th October 2006, 02:38
Jessey,

I was just roaming the meLabs site, and it looks like the P245al.exe Patch might fix the missing register names for the 688.
http://www.melabs.com/support/patches.htm

Until you get a chance to upgrade :)

Hi Darrel,

I downloaded the patch you suggested (just to try it out) and it works great, I can now compile without any errors when using CMCON0 = 7. I also tried using your code http://www.picbasic.co.uk/forum/showthread.php?t=40 (for the first time) to get rid of "Crossing page boundary - ensure page bits are set" from coming up every time I compile and it also works great with my 688. Sounds like I owe you more than a few beers by now!

Thanks Again
jessey

Darrel Taylor
- 30th October 2006, 04:54
>> I also tried using your code ...

:) Good things about the Forum...
    3-1/2 years later, and it's still there.

  Bad things about the Forum...
    It took 3-1/2 years to find it. :eek:

<hr> >> What's your overall favorite microprocessor there Darrel?

Just about anything with an 18F in the part number.
Most used - 18F452 &nbsp; (44-TQFP)
Most Liked - 18F8680
Still waiting to try - (any 18F with a J in the P/N)
If only someone would write a TCP/IP stack for PBP.
<hr>
Hey, I'm kinda thirsty over here. Could you send one of those Beers?
Just pour it in your keyboard, then type in my email address. :cool: