View previous topic :: View next topic |
Author |
Message |
kupikupi
Joined: 03 Sep 2005 Posts: 31
|
|
Posted: Tue Sep 06, 2005 8:10 am |
|
|
thanx Mike and Mark ...
i got a question .. is ccc compiler different from the C18 compiler?? i mean code-wise.. could i use the codes u wrote in a c18 compiler??is the a big difference between them ??
and about the IR .. i haven't the time to try it yet.. coz this week i've got lots of things to do.. but i got a few things i need ask 1st..
im still not sure how the IR works... people tols me to use the SONY remote control .. but why ? could i just use any other remotes??
well im planning to use a detector called TSOP1738 to detect the signal from the remote...
can i upload the codes posted by newguy into the PIC directly?.. he says connect one of the pins to EXT0(B0) of the PIC.. but i dont see any EXT0.. but i got INT0(RB0).. and he's using Sharp GP1UD262XK and i'm using TSOP1738.
and before i try the IR thing with the PIC.. i would like to see the IR sognal on the oscilloscope.. do i have to do anything besides connecting the IR pins to the osciloscope.. could it receive signal from the remote just like that??
thanx alot again ... |
|
|
kupikupi
Joined: 03 Sep 2005 Posts: 31
|
|
Posted: Tue Sep 06, 2005 8:12 am |
|
|
and oh ya ... i'm actually using PIC start plus to program the PIC.. thanx |
|
|
MikeValencia
Joined: 04 Aug 2004 Posts: 238 Location: Chicago
|
|
Posted: Tue Sep 06, 2005 8:53 am |
|
|
kupikupi wrote: | thanx Mike and Mark ...
i got a question .. is ccc compiler different from the C18 compiler?? i mean code-wise.. could i use the codes u wrote in a c18 compiler??is the a big difference between them ??
|
They are very different. The CCS compiler is "Ansi-like", while the C18 is more Ansi-compliant than the CCS compiler. The C18 is very similiar to the Hi-Tech compiler, so to get an idea of the comparison, then look at the following site:
http://www.ccsinfo.com/compare.shtml |
|
|
Mark
Joined: 07 Sep 2003 Posts: 2838 Location: Atlanta, GA
|
|
Posted: Tue Sep 06, 2005 9:10 am |
|
|
They are not that different. I've ported code from CCS to C18 pretty easily. Now going from C18 back to CCS sometimes is a bit more tricky when it comes to pointers to functions and pointers to constants.
It doesn't really matter what remote you use so long as the IR receiver can decode it. You just need to make sure that the transmitter is 38KHz as well. Most are.
Quote: | and about the IR .. i haven't the time to try it yet.. coz this week i've got lots of things to do.. but i got a few things i need ask 1st..
im still not sure how the IR works | Dude, you are in trouble if you have too much to do and do not understand how IR works. That is probably the easy part since you have example code to grab the codes.
Quote: | can i upload the codes posted by newguy into the PIC directly?.. | I believe the code was to "sniff" the codes and display them. This shows what code is transmitted for each button. You would make note of these and then modify the example code to do something when you receive one of the codes that you noted.
Quote: | he says connect one of the pins to EXT0(B0) of the PIC.. but i dont see any EXT0.. but i got INT0(RB0).. | Same thing
Quote: | i would like to see the IR sognal on the oscilloscope.. do i have to do anything besides connecting the IR pins to the osciloscope | You've got to read the datasheet and connect the power and grounds and anything else is says. |
|
|
kupikupi
Joined: 03 Sep 2005 Posts: 31
|
|
Posted: Tue Sep 06, 2005 9:29 am |
|
|
thanx Mark .....
so since newguys codes are for ccs .. what should i do to compile it in c18 ??
Quote: | Dude, you are in trouble if you have too much to do and do not understand how IR works. That is probably the easy part since you have example code to grab the codes.
|
i forgot to mention.. but i actuallly have 2 other guys to help me .. im doing the programming .. so i just had to find how it works ..one of them is doing the motor part and the other is building the chair and helping me a little on the IR part.,...
Quote: | You would make note of these and then modify the example code to do something when you receive one of the codes that you noted. |
u mean as in he display the codes on the LCD and i have to modify it to display on the pc ??
and Mark ... i could just write my codes for c18 , will u check it for me ?
thanx Mark |
|
|
Mark
Joined: 07 Sep 2003 Posts: 2838 Location: Atlanta, GA
|
|
Posted: Tue Sep 06, 2005 9:31 am |
|
|
Quote: | u mean as in he display the codes on the LCD and i have to modify it to display on the pc ??
| Well that's the first part. Then you have to modify it to compare the code received with one that you want to take an action and then take that action.
Quote: | i forgot to mention.. but i actuallly have 2 other guys to help me .. im doing the programming .. so i just had to find how it works ..one of them is doing the motor part and the other is building the chair and helping me a little on the IR part.,...
| Still a bunch of firmware to write and get working for someone that doesn't know about programming micros. |
|
|
kupikupi
Joined: 03 Sep 2005 Posts: 31
|
|
Posted: Tue Sep 06, 2005 10:05 am |
|
|
Mark wrote: | Then you have to modify it to compare the code received with one that you want to take an action and then take that action. |
this was the part i was having problem with .. earlier on i was asking if i could use PWM to convert the signal pulses i received to data bits to drive the motor .. but u said i need the PWM to control the speed .. so what do u suggest i use?? i cant use ADC rite because it's a digital signal coming in..
Quote: | Still a bunch of firmware to write and get working for someone that doesn't know about programming micros. |
yeah ... that's why im struggling here and need help ... really grateful for u helping me here... thanx |
|
|
Guest
|
|
Posted: Tue Sep 06, 2005 10:10 am |
|
|
kupikupi wrote: | Mark wrote: | Then you have to modify it to compare the code received with one that you want to take an action and then take that action. |
this was the part i was having problem with .. earlier on i was asking if i could use PWM to convert the signal pulses i received to data bits to drive the motor .. but u said i need the PWM to control the speed .. so what do u suggest i use?? i cant use ADC rite because it's a digital signal coming in..
|
Have your classmates designed the hardware yet?
If i remember correctly, you are driving two motors with PWM. Thus you need to use PWM1 and PWM2 (CCP1 and CCP2)
Do you have any hardware yet breadboarded for the motor? |
|
|
kupikupi
Joined: 03 Sep 2005 Posts: 31
|
|
Posted: Tue Sep 06, 2005 10:20 am |
|
|
well... he has a H-bridge L298 to drive the motor ... i modified the LED blinking program for the motor to spin in both directions alternately...
but right now im having a headache on the IR part.. how do i decode the signal??( how would the PIC read the pulses?) PWM??( i think i can't since i'll be using it for the motor or perhaps the H-bridge could do the speed control .. ??) |
|
|
kupikupi
Joined: 03 Sep 2005 Posts: 31
|
|
Posted: Tue Sep 06, 2005 10:48 am |
|
|
hi..
i want to ask ... which will be better and easier ?? using a 2nd PIC as a transmitter or the remote control ? could a PIC detect a pulse wave coming from another PIC??
thanx.... |
|
|
Mark
Joined: 07 Sep 2003 Posts: 2838 Location: Atlanta, GA
|
|
Posted: Tue Sep 06, 2005 10:52 am |
|
|
kupikupi wrote: | well... he has a H-bridge L298 to drive the motor ... i modified the LED blinking program for the motor to spin in both directions alternately...
but right now im having a headache on the IR part.. how do i decode the signal??( how would the PIC read the pulses?) PWM??( i think i can't since i'll be using it for the motor or perhaps the H-bridge could do the speed control .. ??) |
Where's the headache coming from? newguy already gave you code to receive the IR signals. Do you understand what comes from the IR transmitter? Read me
You are going to be receiving codes from the remote. You will designate a buttons, lets say "Play" could make the chair go forward. "Stop", well yeah stop. "Rewind" could be left, "Fast Forward" could be right, and so on. When you receive on of these codes, you change the speed and direction of the motors. To control these motors, you will probably want to use the PWM outputs.
Quote: | this was the part i was having problem with .. earlier on i was asking if i could use PWM to convert the signal pulses i received to data bits to drive the motor .. but u said i need the PWM to control the speed | Did you forget that we already said and gave you code to use Int0??? |
|
|
Mark
Joined: 07 Sep 2003 Posts: 2838 Location: Atlanta, GA
|
|
Posted: Tue Sep 06, 2005 10:57 am |
|
|
kupikupi wrote: | hi..
i want to ask ... which will be better and easier ?? using a 2nd PIC as a transmitter or the remote control ? could a PIC detect a pulse wave coming from another PIC??
thanx.... |
I will let you answer that. From asking yourself these questions.
1. Is it easier to design a new piece of hardware that to purchase one that will do the job and I can buy it for around $5.
2. Do I have the time to design the transmitter?
3. Do I understand how a transmitter works?
The only reason you would probably want to design the transmitter is if you really think that it would be cool and have plenty of time. Remember, you would have to design and code both pieces instead of just one. Doesn't that sound like twice the work? |
|
|
kupikupi
Joined: 03 Sep 2005 Posts: 31
|
|
Posted: Tue Sep 06, 2005 11:24 am |
|
|
Mark .. thanx ... i think i'm learning a lot from u ...
Quote: | Did you forget that we already said and gave you code to use Int0??? |
yeah i got it now..
Quote: | You are going to be receiving codes from the remote. You will designate a buttons, lets say "Play" could make the chair go forward. "Stop", well yeah stop. "Rewind" could be left, "Fast Forward" could be right, and so on. When you receive on of these codes, you change the speed and direction of the motors. To control these motors, you will probably want to use the PWM outputs. |
i think i got this too...correct me if i'm wrong..
all this while i was thinking that the transmitter sends an analog signal to the detector and the detector converts the analog signal into pulses of 1s and 0s and from the site u posted .. i found out that the transmitter is the one sending pulses of 1s and 0s to the receiver .. so i guess that the receiver converts the pulses into data bits 1s and 0s , i then read the results from then register and assign each result to do certain instructions such as forward and reverse.. so i can use this to drive the motor... rite??
if i'm rite .. i think i'm on the right track ... u've really helped me alot Mark .. thanx |
|
|
Mark
Joined: 07 Sep 2003 Posts: 2838 Location: Atlanta, GA
|
|
Posted: Tue Sep 06, 2005 12:25 pm |
|
|
Here's another article that can help you understand the data being transmitted. The second part of the article deals with transmitting the data using a PIC. I am pointing the first part of the article out that explains looking at the signals with a DSO.
Quote: | i think i got this too...correct me if i'm wrong..
all this while i was thinking that the transmitter sends an analog signal to the detector and the detector converts the analog signal into pulses of 1s and 0s and from the site u posted .. i found out that the transmitter is the one sending pulses of 1s and 0s to the receiver .. so i guess that the receiver converts the pulses into data bits 1s and 0s , i then read the results from then register and assign each result to do certain instructions such as forward and reverse.. so i can use this to drive the motor... rite??
| Yes, I think you are getting it. The signal being sent by the transmitter is moduated with a carrier frequency. The receiver simply removes this carrier and show you the data. Then you have to decode the data and use it. |
|
|
Mark
Joined: 07 Sep 2003 Posts: 2838 Location: Atlanta, GA
|
|
Posted: Tue Sep 06, 2005 12:39 pm |
|
|
Here's another app note to read. |
|
|
|