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 CCS Technical Support

about pic16f18345

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



Joined: 13 Aug 2004
Posts: 58
Location: Turkey

View user's profile Send private message Visit poster's website

about pic16f18345
PostPosted: Fri Apr 07, 2017 6:37 am     Reply with quote

hey all,
I am trying to do some input function with pic16f18345.
Everything work fine with the PORTA with pinA0 pinA1 pinA2 pinA3 and pinA5.
When it comes to pinA5 I can't get input from this pin.


my code is as below

Code:

void main() {


SET_TRIS_A( 0xFF );
SET_TRIS_B( 0x00 );
SET_TRIS_C( 0xF7 );

loop:

     //if( IOpinIN.rotatelightsw)
if(input(PIN_A5))
   {
  ouptput(pin_B1);
   } 
}

any comment will be appreciated

cheers
_________________
Dr Suleyman CANAN
R&D Electronic Engineer
https://suleymancanan.wordpress.com

Do whatever you do with amateur spirit -
But always feel professional.


Last edited by scanan on Fri Apr 07, 2017 7:46 am; edited 1 time in total
temtronic



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

View user's profile Send private message

PostPosted: Fri Apr 07, 2017 6:53 am     Reply with quote

quick answer

1st you should always post a complete test program as it could be a 'fuses' problem maybe even compiler version....

That pin, RA5, has several peripherals attached to it, so you should disable all of them, ADC, clock, timer, etc. whatever is attached....


Jay
scanan



Joined: 13 Aug 2004
Posts: 58
Location: Turkey

View user's profile Send private message Visit poster's website

PostPosted: Fri Apr 07, 2017 7:09 am     Reply with quote

here with extras

CCS ver. 5.062
Code:


#include <16f18345.h>
/////////////////////////////////FUSES/////////////////////////////////////////
#use delay(internal=32M)

#FUSES RSTOSC_HFINTRC_PLL
#Fuses PUT ,NOWDT,NOLPBOR,NOBROWNOUT,PROTECT
#Fuses NOCLKOUT,NOCKS,NOFCMEN,NOMCLR
#Fuses NOPPS1WAY,PPS1WAY,NOSTVREN,STVREN,DEBUG,NODEBUG,WRT,WRT_400


void main() {


SET_TRIS_A( 0xFF );
SET_TRIS_B( 0x00 );
SET_TRIS_C( 0xF7 );

loop:

     //if( IOpinIN.rotatelightsw)
if(input(PIN_A5))
   {
  ouptput(pin_B1);
   } 
}

_________________
Dr Suleyman CANAN
R&D Electronic Engineer
https://suleymancanan.wordpress.com

Do whatever you do with amateur spirit -
But always feel professional.
Ttelmah



Joined: 11 Mar 2010
Posts: 19499

View user's profile Send private message

PostPosted: Fri Apr 07, 2017 10:45 am     Reply with quote

You have a whole suite of fuses, where you are telling the compiler both to set them, and clear them. For instance:

NOPPS1WAY,PPS1WAY

This says 'turn off PPS1WAY', and 'turn on PPS1WAY'.

Which it'll actually use is a guess (probably the last).

Fuses need to only be set one way or the other, not both....

As written the code will drop off the end, and go to sleep.

You are then trying to output to the pin with a function called 'ouptput', and not saying 'what' you want to output to the pin.

Then the chip doesn't have a pin 'B1'....
Port B pins start at B4 on this chip.

I doubt if the code would compile. Sad

Once these are fixed, I'd suspect Temtronic is on the right lines with a peripheral needing to be disabled. Pin A5 is the default clock input for some things.

It also will not run without a debugger as posted.
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