CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

can't control pullups

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
pmuldoon



Joined: 26 Sep 2003
Posts: 218
Location: Northern Indiana

View user's profile Send private message

can't control pullups
PostPosted: Thu Oct 13, 2011 7:14 am     Reply with quote

CCS ver 4.125
chip 16F505

The weak pullups default on and I can't turn them off.
the header file sez:
Quote:
// Discrete I/O Functions: SET_TRIS_x(), OUTPUT_x(), INPUT_x(),
// PORT_x_PULLUPS(), INPUT(),
// OUTPUT_LOW(), OUTPUT_HIGH(),
// OUTPUT_FLOAT(), OUTPUT_BIT()


but the compiler doesn't recognize the port_b_pullups() function.

the header also sez:
Quote:
#define DISABLE_PULLUPS 0x40 // for 508 and 509 only

I tried that even tho it is for the smaller chips (option reg is similar) but stil l no luck.

I finally forced it using #asm and it seems to be setup properly now.
Here's both - I've no clue what the compiler was trying to do.

Code:
   setup_wdt(WDT_18MS | DISABLE_PULLUPS);
   #asm
   movlw   0x48
   option
   #endasm

lists as this:
Code:
....................    setup_wdt(WDT_18MS | DISABLE_PULLUPS);
009A:  CLRF   08
009B:  CLRF   01
009C:  MOVLW  0F
009D:  OPTION
009E:  CLRWDT
009F:  MOVF   08,W
00A0:  OPTION
....................    #asm
....................    movlw   0x48
00A1:  MOVLW  48
....................    option
00A2:  OPTION
....................    #endasm


Am I just missing something here, or is it a compiler bug? Like many of you, I'm working on a project due yesterday...
temtronic



Joined: 01 Jul 2010
Posts: 9163
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Thu Oct 13, 2011 9:24 am     Reply with quote

I downloaded the datasheet and in the 'summary of port registers' it says that both 'wakeup pullup' and 'pullup' are defaulted to OFF ( set high ).
With that in mind, I suspect the compiler's got a bug.
Also looked at the header file and like you the 508 values should work for the 505.
It's be interesting to see what the listing says is being set(or reset in this case).
pmuldoon



Joined: 26 Sep 2003
Posts: 218
Location: Northern Indiana

View user's profile Send private message

PostPosted: Thu Oct 13, 2011 9:31 am     Reply with quote

Thanks, I thought I was just missing something.
I'll fwd to CCS tech support.
Ttelmah



Joined: 11 Mar 2010
Posts: 19337

View user's profile Send private message

PostPosted: Thu Oct 13, 2011 9:45 am     Reply with quote

If you try with 3.249, You will see that though it does a bit of extra work, it does end up writing 0x48 to the option register, if 0x48 is given as the value to use:
Code:

.................... setup_wdt(0x48);
0003:  MOVLW  48
0004:  MOVWF  08
0005:  MOVLW  07
0006:  CLRF   01
0007:  MOVLW  0F
0008:  OPTION
0009:  CLRWDT
000A:  MOVF   08,W
000B:  OPTION


However, repeat with any of the V4 compilers, and it seems to screw this up, writing zero instead....

Definately a bug I'm afraid.

Best Wishes
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group