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

Problem with set_port_b on PIC16F1847

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



Joined: 15 Mar 2021
Posts: 37

View user's profile Send private message

Problem with set_port_b on PIC16F1847
PostPosted: Sat Apr 24, 2021 10:10 am     Reply with quote

Hi everyone I am working with PIC16F1847 and I want to configure the pin RB0 as input but every time I am getting an Undefined identifier set_port_b_tris from the compilier.
Could you please let me know what can be the problem?
The compiler is CCS v5.065
The IDE is MPLAB X IDE v5.40
Thanks
Code:

set_port_b_tris(0x0F);            // configure RB0~4 ins as inputs
Ttelmah



Joined: 11 Mar 2010
Posts: 19219

View user's profile Send private message

PostPosted: Sat Apr 24, 2021 10:23 am     Reply with quote

Why not try reading the manual....

The tris command is set_tris_b No 'set_port'. Also if you use standard_io,
you basically never need to actually set the tris. Simply
output_high(PIN_B0) or output_low(PIN_B0) will output the bit and set the
tris for you.
temtronic



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

View user's profile Send private message

PostPosted: Sat Apr 24, 2021 10:38 am     Reply with quote

quick comment..
when doing 'bit level' stuff, like pin directions on a port...) it's easier to use 0b00001111 instead of 0x0f. Visually the brain 'sees the upper nibble as outputs, the lower 4 bits as inputs. (0=Output, 1=Input).
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