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

Continuity test between ports

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



Joined: 07 Apr 2008
Posts: 49

View user's profile Send private message

Continuity test between ports
PostPosted: Sun Sep 07, 2014 2:23 pm     Reply with quote

How would I test a pair of wires connected to RB0-RD0 and RB2-RD2 for continuity and or shorting?

I'm trying to understand how a pair of ports on a single mcu can determine continuity and/or shorting between the two lines.

Basically a 2 wire cable tester.

I'm not getting the concept for some reason, any help would be appreciated.
temtronic



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

View user's profile Send private message

PostPosted: Sun Sep 07, 2014 2:33 pm     Reply with quote

basic electrical continuity


set a 'one' on one wire, read the result which should be a 'one' on THAT one wire..if true, that wire is good

if false, it's busted

if the 'one' appears on any other wire, it's shorted to the other wire.

there is a 'cat5 cable' test program on the forum...you could cheat and just use that IF it works BUT you better KNOW how it works when the teacher asks you !!!


hth
jay
Aurbo



Joined: 07 Apr 2008
Posts: 49

View user's profile Send private message

PostPosted: Sun Sep 07, 2014 2:39 pm     Reply with quote

Thanks for the quick response, and the tip

As for the teacher.. not had to deal with one in nearly 35 years.
Aurbo



Joined: 07 Apr 2008
Posts: 49

View user's profile Send private message

PostPosted: Tue Sep 09, 2014 5:48 pm     Reply with quote

I cannot find the cable tester thread you mentioned.

If I understand the theory correctly

1.set both ports as input (tris registers to 0xFF)
2.set a single pin as output and set high
3.set remaining pins as input
4.scan input port for the signal from the output pin, if more than one input pin received the signal then a short exists. (more than one input pin goes high)
5.save the results
6.repeat steps 2-5 until all pins have been checked.

7.display results.
temtronic



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

View user's profile Send private message

PostPosted: Tue Sep 09, 2014 6:34 pm     Reply with quote

CCS has a few functions you can use to make things go easy..

bit_set() , and bit_test().. See the help files( F11 when project is open) for proper use.

Since you only have 2 wires it is easy

bit clear (turn off) RB2 ( the second wire connection)
bit set( turn on) RB0. (the first wire connection)
Now test RD0 using bit_test().
If it is a one( true) then the wire is connected
If it is a zero(false) then the wire is busted
Now test RD2 using bit_test().
If it is a one(true) then RB0 is connected(shorted) to RD2
If it's a zero(false) then no connection(good)

The 'trick' is to think in small,easy to test steps, and proceed in a logical pattern.Once you get it to work for 1 wire, simply copy but recode for the I/O pins in use.

Be sure to read the manual to get the proper syntax for the tests though !!

hth
jay
ezflyr



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

View user's profile Send private message

PostPosted: Wed Sep 10, 2014 7:34 am     Reply with quote

Hi,

Here is the thread that temtronic referred to: http://www.ccsinfo.com/forum/viewtopic.php?t=52203&highlight=cable

Be sure to read the whole thread, and to follow the link that PCM programmer provided. That link is to a complete PIC based cable tester using CCS 'C'.

John
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