PR13 modification

LED Blinking, Walking with Cytron Servo, Displaying RFID, Multi-function Mobile Robot......

PR13 modification

Postby ahbong » Sat Jan 26, 2013 4:07 pm

im new in using PIC technology. .so i need some help to learn it. .

1.how to activate other pic function? eg in the pr13 timer is OFF so how to get it on? if using code how?

2.need some recommendation in modifying this project. eg. any other function can be added or device.


TQ :geek:
ahbong
Freshie
 
Posts: 4
Joined: Sat Jan 26, 2013 4:02 pm

Re: PR13 modification

Postby yonghui » Mon Jan 28, 2013 1:57 pm

hi,
u can refer to the pic's datasheet, for the timer, refer to the timer section, to set it on, set the timer's "ON" register.

u can write any function u like
thanks&regards,
yh
yonghui
Moderator
 
Posts: 732
Joined: Mon Sep 28, 2009 3:27 pm

Re: PR13 modification

Postby ahbong » Mon Jan 28, 2013 10:26 pm

so if i want to make extra LED and when its satisfy certain condition in PR13 the LED blink like the police car light. .
one LED at a time. .do i need to turn the timer on?

and if yes. .does it give only delay time for the LED from 1 to another. .
cause i dont really understand what the timer do actually. . :?:
ahbong
Freshie
 
Posts: 4
Joined: Sat Jan 26, 2013 4:02 pm

Re: PR13 modification

Postby ABSF » Wed Jan 30, 2013 7:19 pm

ahbong WROTE:so if i want to make extra LED and when its satisfy certain condition in PR13 the LED blink like the police car light. .
one LED at a time. .do i need to turn the timer on?


I dont know how the police car lighting sequence looks like. But if you know the sequence in detail, you could almost duplicate the LED pattern with the correct codes.

There are only 3 LED and 3 switches on the PR13 PCB. So if you need more LED to display, you'd have to add them externally...

ahbong WROTE:and if yes. .does it give only delay time for the LED from 1 to another. .
cause i dont really understand what the timer do actually. . :?:


You can use either time delay sub-routines or timer to do the delay function. Timer is more accurate (to mS) so you can make a Real Time Clock using timer to generate the time base of 1 Hz.

Your question is too general and it's hard for others to answer.

Use google to search for the uses of timer and see how people use them in their programs. That's how I learn how to use timers in PIC.

Allen
The next war will determine NOT who is right BUT what is left.
User avatar
ABSF
Professional
 
Posts: 810
Joined: Wed Nov 10, 2010 9:32 am
Location: E Malaysia

Re: PR13 modification

Postby ahbong » Thu Jan 31, 2013 11:25 pm

tq allen. .

ive added 3 new LED on the project with each of them have different input from the pic. .
my next question if i change the LED to for example bulb(like in the torchlight) will i need to increase current/voltage input?
ahbong
Freshie
 
Posts: 4
Joined: Sat Jan 26, 2013 4:02 pm

Re: PR13 modification

Postby ABSF » Fri Feb 01, 2013 10:51 am

ahbong WROTE:my next question if i change the LED to for example bulb(like in the torchlight) will i need to increase current/voltage input?


If your bulb uses more than 20mA, it would be advisable to put a NPN transistor in between the pic output and the bulb. Add a 1K resistor from the Base of transistor to the pic.

If there is more than 1 bulb, you can use ULN2803 or ULN2003 darlington drivers.

Allen
The next war will determine NOT who is right BUT what is left.
User avatar
ABSF
Professional
 
Posts: 810
Joined: Wed Nov 10, 2010 9:32 am
Location: E Malaysia

Re: PR13 modification

Postby ahbong » Wed Feb 06, 2013 12:33 am

tq for the info. .
i stick to the led but i encounter new problems. .

ive define the PIC RA2 to RA4 to set as a new indicator light to show which mode is ON using new LED. .
but nothing happen. .when a specific pushbutton that have each of its on mode is ON. .the led didnt respond to the input "1"
that were given. .it make me confuse because ive define 3 new sets of LED and 1 pushbutton as a new mode and it work just by playing its c coding. .is it the RA2 to RA4 family have its own fixed purpose?
ahbong
Freshie
 
Posts: 4
Joined: Sat Jan 26, 2013 4:02 pm

Re: PR13 modification

Postby ABSF » Wed Feb 06, 2013 10:54 pm

ahbong WROTE:ive define the PIC RA2 to RA4 to set as a new indicator light to show which mode is ON using new LED. .
but nothing happen. .when a specific pushbutton that have each of its on mode is ON. .the led didnt respond to the input "1"
that were given. .it make me confuse because ive define 3 new sets of LED and 1 pushbutton as a new mode and it work just by playing its c coding. .is it the RA2 to RA4 family have its own fixed purpose?


The Port A of 16F87x family has ADC built in and it was defaulted to analog. If you want to use them as digital port you need to configure them to digital using ADCON1=0x06; just before you set the TRISA to output.

The details are in chapter 3.1 of the 16f87x datasheet.

Allen
The next war will determine NOT who is right BUT what is left.
User avatar
ABSF
Professional
 
Posts: 810
Joined: Wed Nov 10, 2010 9:32 am
Location: E Malaysia

Re: PR13 modification

Postby robosang » Thu Feb 07, 2013 10:01 am

Yup, Allen is correct. Each IO pin on PIC can be Input or output, for RA pin, most of it is analog, so basically there are 2 things need to be done before you can use it.

1. make it output.
2. make it digital pin.
robosang
Expert
 
Posts: 1239
Joined: Wed Jun 10, 2009 5:37 pm


Return to DIY Project Set

Who is online

Users browsing this forum: No registered users and 21 guests

cron