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

PIC16F877A Based Diode Tester in CCS C

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



Joined: 07 Dec 2010
Posts: 1

View user's profile Send private message

PIC16F877A Based Diode Tester in CCS C
PostPosted: Tue Dec 07, 2010 7:23 am     Reply with quote

Hello

Code for Diode tester


Code:
/*Diode Tester  Written By Shibu.V  www.keralalinux.com and
 www.zerovolt.com. Diode can be connect in any direction,
 Port used are PB0 and PB1  Processor PIC16F877A*/
 
#include <16F877A.h>
#device adc=8
#FUSES NOWDT,HS,NOPROTECT                   
#use delay(clock=20000000)
#include <lcd.c>

#define testpin1 PIN_B0
#define testpin2 PIN_B1

void main()
{

unsigned int test1=0,test2=0;
//Test Diode

lcd_init();
Lcd_gotoxy(1,1);
Lcd_Putc("Diode Test");
output_high(testpin1);
test1=input(testpin2);
output_low(testpin1);

output_high(testpin2);

test2=input(testpin1);

if((test1==1) && (test2==1)){

Lcd_gotoxy(1,2);
Lcd_Putc("Short");}

if((test1==0) && (test2==1)){

Lcd_gotoxy(1,2);
Lcd_Putc("Good");
}
if((test1==1) && (test2==0)){

Lcd_gotoxy(1,2);
Lcd_Putc("Good");
}
if((test1==0) && (test2==0)){
Lcd_gotoxy(1,2);
Lcd_Putc("open");
}
delay_ms(1000);
}



See the Circuit and working code download at
http://www.keralalinux.com/2010/12/04/pic16f877a-based-diode-tester-in-ccs-c.html
temtronic



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

View user's profile Send private message

PostPosted: Tue Dec 07, 2010 8:49 am     Reply with quote

It's nice to see a useful, interesting project !

Simple in concept,easy to follow and it WORKS!

I can see the next version using the ADC section to read the voltages on the cathode and anodes,taking the difference and computing whether it's a schottky,power or LED that is being tested.Even the colour of the LED being tested could be figured out!

Good work.
dbotkin



Joined: 08 Sep 2003
Posts: 197
Location: Omaha NE USA

View user's profile Send private message Send e-mail Visit poster's website

PostPosted: Tue Dec 07, 2010 9:31 am     Reply with quote

Nice. :) I like temtronic's idea too, determining the type of diode (and Zener voltage, if applicable).

As for LED color... that should be pretty easy to determine visually while testing is in progress. :) Although, maybe it would be useful for people who are red/green color blind!
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