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

Shiftin on Port B

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



Joined: 16 Feb 2004
Posts: 26

View user's profile Send private message

Shiftin on Port B
PostPosted: Tue Mar 22, 2005 4:06 am     Reply with quote

Hi,
I was wondering if anyone clould take a look at this and give any idea where it is going wrong.
The pins are connected to a CPLD which is a 32 bit counter with a multiplexer controlled by the outputs of portA. The loop steps thru the various addresses of the multiplexer selecting which bit to put onto pin_b3.
Pin_b2 just enables the multiplexer.
I know the hardware works fine as I have had it running with PicBAsic Pro.
I am new to the shiftin command and suspect thats where the problem may lie.

#byte PORTA = 5
#define ALL_OUT 0
#define ALL_IN 0xff
#use fast_io(A)

void ReadScan()
{
int n,data;
int32 buffer;
set_tris_a(ALL_OUT);
output_low(pin_b2);

for(n=0;n<=31;n++)
{
porta=n;
output_high(pin_b2);
shift_left(&buffer,4,input(pin_B3));
output_low(pin_b2);
}
printf(" %08lx \n\r",buffer);
return;
}

Ive looked at pin_B2 and portA on the scope and they seems to be operating as required. Nothing coming in on B3 though.
Thanks
Steve
Mark



Joined: 07 Sep 2003
Posts: 2838
Location: Atlanta, GA

View user's profile Send private message Send e-mail

PostPosted: Tue Mar 22, 2005 7:36 am     Reply with quote

You should post a small but complete program and use the code button. As for the problem the code looks okay to me. My guess is that you are using a 16F87X device and didn't specify NOLVP in the fuses. RB3 is the LVP pin on these devices.
Guest








PostPosted: Wed Mar 23, 2005 2:01 am     Reply with quote

All sorted. Thanks to all for the advice.
Cheers
Steve
Mark



Joined: 07 Sep 2003
Posts: 2838
Location: Atlanta, GA

View user's profile Send private message Send e-mail

PostPosted: Wed Mar 23, 2005 10:41 am     Reply with quote

So what was the problem?
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