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

Disable analog 18F26k22

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



Joined: 25 Aug 2015
Posts: 18

View user's profile Send private message

Disable analog 18F26k22
PostPosted: Tue Mar 01, 2016 9:03 am     Reply with quote

Hi

I need disable analog input mode on pin RC7 of 18F26k22. Please help
temtronic



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

View user's profile Send private message

PostPosted: Tue Mar 01, 2016 9:11 am     Reply with quote

You should post a small program so we can see what you're doing. As that pin is also used for 3 other peripherals it is possible.

Jay
J_GROUP



Joined: 25 Aug 2015
Posts: 18

View user's profile Send private message

PostPosted: Tue Mar 01, 2016 9:36 am     Reply with quote

Code:
#include <18f26k22.h>
#device  *=16
#include <math.h>
#include <float.h>
#include <stdio.h>
#include <brands_select.h>

#fuses WDT8192,PROTECT,NOLVP,MCLR,NOBROWNOUT,NOXINST
#fuses HSM,PLLEN


#use delay(clock=32000000,crystal=8000000, RESTART_WDT)
#USE RS232 (UART1, BAUD = 9600, XMIT = PIN_C6, RCV = PIN_C7,bits=8)       //RS-232 parametres


#int_RDA
void rda_interrupt()
{
#USE RS232 (UART1)
st=getc();
str_check[ic]=st;
ic=ic+1;
output_high(Signal_led);
if (ic>84) {ic=1; str_check[0]=str_check[84]; }
}
ezflyr



Joined: 25 Oct 2010
Posts: 1019
Location: Tewksbury, MA

View user's profile Send private message

PostPosted: Tue Mar 01, 2016 10:32 am     Reply with quote

Hi,

What compiler version are you running? You shouldn't have to explicitly 'turn off' analog input mode on C7 once you've setup the hardware UART. You should also post a complete, compilable program for us to look at. Your program is very incomplete, lacking a Main(), and numerous variable declarations.

Are you sure your PIC is running? Is it running at the intended speed? Have you done the classic 'LED flash' test?
_________________
John

If it's worth doing, it's worth doing in real hardware!


Last edited by ezflyr on Tue Mar 01, 2016 11:08 am; edited 1 time in total
J_GROUP



Joined: 25 Aug 2015
Posts: 18

View user's profile Send private message

PostPosted: Tue Mar 01, 2016 10:42 am     Reply with quote

sir,

this program and hardware I was running on 18F25k22. This time I need more memory so I change to 18F26k22 and get trouble
temtronic



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

View user's profile Send private message

PostPosted: Tue Mar 01, 2016 10:54 am     Reply with quote

John's right, again..
we NEED a small, complete, compilable program to help further.

What you've shown already has several coding errors
including but not limitied to
protect fuse enabled
lack of errors option in use rs232(...)
wdt set to restart
incomplete list of fuses
include of brands_select.h 'header', unknown to us, NOT CCS supplied

I use the 'big brother 18F46K22' as my main PIC and have no problems using RC7 for other uses.

jay
jeremiah



Joined: 20 Jul 2010
Posts: 1349

View user's profile Send private message

PostPosted: Tue Mar 01, 2016 11:51 am     Reply with quote

You also have
Code:

#USE RS232 (UART1)


inside the ISR, which is meaningless and could be your problem if the default values for the two chips differ.

#use rs232() is not run time code. It is a precompiled directive. It should not be inside of a function.
Ttelmah



Joined: 11 Mar 2010
Posts: 19513

View user's profile Send private message

PostPosted: Tue Mar 01, 2016 2:23 pm     Reply with quote

and the fuses, clock statement, and RS232 declarations, should always be _before_ the other includes. Otherwise anything in these using RS232, or delays, may well not function....
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