Welcome Guest ( Log In | Register )

35 Pages « < 16 17 18 19 20 > » Bottom

Outline · [ Standard ] · Linear+

Hobbies Electronics Enthusiasts Club, All elect/robotics lovers! pls come!

views
     
Cerita Dongeng
post Aug 7 2009, 05:28 PM

New Member
*
Junior Member
16 posts

Joined: Jun 2009
Don't you need to set U1BRG register in relation with your oscillator frequency as to get the correct baud rate?

When BRGH = 1 for High baud rate then U1BRG = (Fosc/4 * Buad Rate) - 1
When BRGH = 0 for Low Baud rate then U1BRG = (Fosc/16 * Buad Rate) - 1

Could be wrong. Better check up the datasheet.

This post has been edited by Cerita Dongeng: Aug 7 2009, 05:54 PM
e-fatty
post Aug 7 2009, 06:46 PM

Getting Started
**
Junior Member
202 posts

Joined: May 2005


QUOTE(tgrrr @ Aug 7 2009, 05:13 PM)
From the link all you need is a level translator to convert TTL to RS232 signal. You're attempting to use PIC because of some reason or for fun? And even if you use a PIC, you still need a level shifter.

Anyway I think you are trying to use the built-in hardware UART module plus a software UART. The problem is your software UART is non-existence.
Like this piece of code,
while(PIR1bits.RCIF==0);
PORTBbits.RB6=RCREG;


RCREG should contains a full byte of data received from the hardware UART.
You can't just assign them to pin6 of portb like that. You have to send out the individual bits in them one by one, AND watch the timing as you send them out or it'll end up as unreadable junk on the other end.
*
The reason is i can't get my hands on the converter.

If you have one pls sell it to me.
Or can you lend it to me?
I'll pay for the postage fees for you.
Will definately return it to you.

By level shifter you mean changing the voltage?

the while(PIR1bits.RCIF==0); is to wait until the interupt flag is one. Much like waiting for an input.

Isn't it anything you type in HyperTerminal bput into RCREG?
So in short the program doesn't work does it... T_T


Added on August 7, 2009, 6:50 pm
QUOTE(Cerita Dongeng @ Aug 7 2009, 05:28 PM)
Don't you need to set U1BRG register in relation with your oscillator frequency as to get the correct baud rate?

When BRGH = 1 for High baud rate then U1BRG = (Fosc/4 * Buad Rate) - 1
When BRGH = 0 for Low Baud rate then U1BRG = (Fosc/16 * Buad Rate) - 1

Could be wrong. Better check up the datasheet.
*
From what i learnt is we are using SPBRG for the baudrate register (PIC18F4580)

so its SPBRG = (Fosc/(64 * Buad Rate)) - 1

so what i get is 7

This post has been edited by e-fatty: Aug 7 2009, 06:50 PM
Cerita Dongeng
post Aug 7 2009, 06:51 PM

New Member
*
Junior Member
16 posts

Joined: Jun 2009
QUOTE(e-fatty @ Aug 7 2009, 06:46 PM)
The reason is i can't get my hands on the converter.
*
RS232-TTL level converter is easy to make. If you don't mind transistors oriented shifter, search google.


Added on August 7, 2009, 7:01 pm
QUOTE(e-fatty @ Aug 7 2009, 06:46 PM)
The reason is i can't get my hands on the converter.

If you have one pls sell it to me.
Or can you lend it to me?
I'll pay for the postage fees for you.
Will definately return it to you.

By level shifter you mean changing the voltage?

the while(PIR1bits.RCIF==0); is to wait until the interupt flag is one. Much like waiting for an input.

Isn't it anything you type in HyperTerminal bput into RCREG?
So in short the program doesn't work does it... T_T


Added on August 7, 2009, 6:50 pm
From what i learnt is we are using SPBRG for the baudrate register (PIC18F4580)

so its SPBRG = (Fosc/(64 * Buad Rate)) - 1

so what i get is 7
*
7 as in Hex (not Dec).

This post has been edited by Cerita Dongeng: Aug 7 2009, 07:01 PM
tgrrr
post Aug 7 2009, 10:06 PM

Enthusiast
*****
Senior Member
939 posts

Joined: Jan 2003
From: Penang
QUOTE(e-fatty @ Aug 7 2009, 06:46 PM)
The reason is i can't get my hands on the converter.

If you have one pls sell it to me.
Or can you lend it to me?
I'll pay for the postage fees for you.
Will definately return it to you.

By level shifter you mean changing the voltage?
*
Level shifter you can simply grab one from jalan pasar or get from farnell, they are pretty common IC. Search for MAX232. This way takes the least amount of effort.
Or as Cerita Dongeng suggested, you can try building one using transistor or other basic component, this will be ok if you're comfortable with electronics.

Note you need a level translator (also called level shifter) EVEN if you have PIC. The reason is the output from your hdd is TTL (0 to 3.3v/5v) whereas the pc com port is RS232 (usually around +9 to -9v). Connecting +9v or -9v to any pin of your hdd is probably going to kill it.
And take note TTL can mean 3.3v or 5v, and they are mostly but not always interchangeable e.g. if your hdd UART is 3.3v tolerant only and you connect it to your PIC that pumps out 5v, something bad can happen.


QUOTE(e-fatty @ Aug 7 2009, 06:46 PM)
the while(PIR1bits.RCIF==0); is to wait until the interupt flag is one. Much like waiting for an input.

Isn't it anything you type in HyperTerminal bput into RCREG?
So in short the program doesn't work does it... T_T
*
Whatever you type in HyperTerminal get's send out by pc as a string of bits, and the PIC hardware UART detects the start bit, collects all the data bits, pack them into a byte, place them in the RCREG AND set the flag telling you it's received a byte.
PIC only has one hardware UART. Since you need another UART, you need to handle all of these in the software yourself!

And there are other problems with your code. I just highlighted one of the problem because I think writing software UART is not very easy and I don't know if you can handle it or are willing to try, especially since you don't really need it. But if you still want to try a software UART it's up to you.
Aurora
post Aug 7 2009, 11:42 PM

On my way
****
Senior Member
630 posts

Joined: Jan 2003


I think the intention of the guide is to establish direct communication between hdd and PC only with a TTL-RS232 converter. nod.gif

Anyway, you can connect the tx/rx directly to the hdd, provided you step down the voltage. This can be easily done with simple transistor circuit.

As for the communication between PIC and PC, you can use the circuit in your book, how to connect a MAX232 to your PIC. The circuit is common, you can't go wrong with that. You can get MAX232 chip in jalan pasar.

For starter, I think best if you leave out the hdd first. Try work on the communication between PC and PIC. Connect a few LED to your PIC, and try to send command via hyperterminal. Just relay the bits to the LED. Next try with few push buttons, and test if the PC received the signal from the PIC. One step at a time, it's easier to troubleshoot this way, especially when you are writing the software UART code. wink.gif

To insert your code, used the {code}{/code} (Replace {} with [])

» Click to show Spoiler - click again to hide... «

Cerita Dongeng
post Aug 8 2009, 09:10 AM

New Member
*
Junior Member
16 posts

Joined: Jun 2009
QUOTE(Aurora @ Aug 7 2009, 11:42 PM)
I think the intention of the guide is to establish direct communication between hdd and PC only with a TTL-RS232 converter. nod.gif

Anyway, you can connect the tx/rx directly to the hdd, provided you step down the voltage. This can be easily done with simple transistor circuit.

As for the communication between PIC and PC, you can use the circuit in your book, how to connect a MAX232 to your PIC. The circuit is common, you can't go wrong with that. You can get MAX232 chip in jalan pasar.

For starter, I think best if you leave out the hdd first. Try work on the communication between PC and PIC. Connect a few LED to your PIC, and try to send command via hyperterminal. Just relay the bits to the LED. Next try with few push buttons, and test if the PC received the signal from the PIC. One step at a time, it's easier to troubleshoot this way, especially when you are writing the software UART code.  wink.gif
Old news repacked behind computer screen.
e-fatty
post Aug 12 2009, 01:02 PM

Getting Started
**
Junior Member
202 posts

Joined: May 2005


QUOTE(Cerita Dongeng @ Aug 7 2009, 06:51 PM)
RS232-TTL level converter is easy to make. If you don't mind transistors oriented shifter, search google.


Added on August 7, 2009, 7:01 pm
7 as in Hex (not Dec).
*
Dude 7 in Hex= 7 in Dec la


Added on August 12, 2009, 1:04 pm
QUOTE(tgrrr @ Aug 7 2009, 10:06 PM)
Level shifter you can simply grab one from jalan pasar or get from farnell, they are pretty common IC. Search for MAX232. This way takes the least amount of effort.
Or as Cerita Dongeng suggested, you can try building one using transistor or other basic component, this will be ok if you're comfortable with electronics.

Note you need a level translator (also called level shifter) EVEN if you have PIC. The reason is the output from your hdd is TTL (0 to 3.3v/5v) whereas the pc com port is RS232 (usually around +9 to -9v). Connecting +9v or -9v to any pin of your hdd is probably going to kill it.
And take note TTL can mean 3.3v or 5v, and they are mostly but not always interchangeable e.g. if your hdd UART is 3.3v tolerant only and you connect it to your PIC that pumps out 5v, something bad can happen.
Whatever you type in HyperTerminal get's send out by pc as a string of bits, and the PIC hardware UART detects the start bit, collects all the data bits, pack them into a byte, place them in the RCREG AND set the flag telling you it's received a byte.
PIC only has one hardware UART. Since you need another UART, you need to handle all of these in the software yourself!

And there are other problems with your code. I just highlighted one of the problem because I think writing software UART is not very easy and I don't know if you can handle it or are willing to try, especially since you don't really need it. But if you still want to try a software UART it's up to you.
*
So that means its easiest to get the converter straight rather than writing a UART prog in PIC?

The problem is i'm from Perlis and its hard to get these kinda stuff....


Added on August 12, 2009, 1:05 pm
QUOTE(Aurora @ Aug 7 2009, 11:42 PM)
I think the intention of the guide is to establish direct communication between hdd and PC only with a TTL-RS232 converter. nod.gif

Anyway, you can connect the tx/rx directly to the hdd, provided you step down the voltage. This can be easily done with simple transistor circuit.

As for the communication between PIC and PC, you can use the circuit in your book, how to connect a MAX232 to your PIC. The circuit is common, you can't go wrong with that. You can get MAX232 chip in jalan pasar.

For starter, I think best if you leave out the hdd first. Try work on the communication between PC and PIC. Connect a few LED to your PIC, and try to send command via hyperterminal. Just relay the bits to the LED. Next try with few push buttons, and test if the PC received the signal from the PIC. One step at a time, it's easier to troubleshoot this way, especially when you are writing the software UART code.  wink.gif

To insert your code, used the {code}{/code} (Replace {} with [])

» Click to show Spoiler - click again to hide... «

*
Yeah i'm learning it through LED, sensors and Motors. Last sem we used assembly but now we're learning in C.



This post has been edited by e-fatty: Aug 12 2009, 01:05 PM
fantasy1989
post Aug 12 2009, 01:06 PM

Look at all my stars!!
*******
Senior Member
4,706 posts

Joined: May 2008



can anyone teach me how to control stepper motor with using parallel port? newbie for electronics ..need for my final year project ...=)

thanks
jiaxun
post Aug 12 2009, 03:40 PM

- Wh@†Eve® - ™
******
Senior Member
1,352 posts

Joined: Jun 2007
Hi,

I would like to make something like a birthday song card, but the birthday song is replaced by the song of my choice.

Does anybody knows where can I get such a programmable IC and how to program it? Besides, I would like a guide on how to make that circuit.

Thank you.
tgrrr
post Aug 12 2009, 06:20 PM

Enthusiast
*****
Senior Member
939 posts

Joined: Jan 2003
From: Penang
QUOTE(e-fatty @ Aug 12 2009, 01:02 PM)
The problem is i'm from Perlis and its hard to get these kinda stuff....
*
Buy online from Farnell, they'll ship to your doorstep. Pay through maybank cash deposit or maybank2u online.
See here -->Max232 @ Farnell


Added on August 12, 2009, 6:33 pm
QUOTE(fantasy1989 @ Aug 12 2009, 01:06 PM)
can anyone teach me how to control stepper motor with using parallel port? newbie for electronics ..need for my final year project ...=)

thanks
*

I think parallel port is all but dead. Why do you want to use parallel port? Do you already have some tools to control the parallel port with?


QUOTE(jiaxun @ Aug 12 2009, 03:40 PM)
Hi,

I would like to make something like a birthday song card, but the birthday song is replaced by the song of my choice.

Does anybody knows where can I get such a programmable IC and how to program it? Besides, I would like a guide on how to make that circuit.

Thank you.
*

I don't know if the kind of programmable IC you're looking for exists.
You can make your own simple audio player using micro-controllers like PIC, but you'll need to write the whole program, not just the song you wanted to play.

This post has been edited by tgrrr: Aug 12 2009, 06:33 PM
fantasy1989
post Aug 12 2009, 07:53 PM

Look at all my stars!!
*******
Senior Member
4,706 posts

Joined: May 2008



QUOTE(tgrrr @ Aug 12 2009, 06:20 PM)
Buy online from Farnell, they'll ship to your doorstep. Pay through maybank cash deposit or maybank2u online.
See here -->Max232 @ Farnell


Added on August 12, 2009, 6:33 pmI think parallel port is all but dead. Why do you want to use parallel port? Do you already have some tools to control the parallel port with?
I don't know if the kind of programmable IC you're looking for exists.
You can make your own simple audio player using micro-controllers like PIC, but you'll need to write the whole program, not just the song you wanted to play.
*
my project is using computer to control stepper motor ...via parallel port ...any sample program? ..i wanna make it like door OPEN n CLOSE (slide)
jiaxun
post Aug 12 2009, 09:33 PM

- Wh@†Eve® - ™
******
Senior Member
1,352 posts

Joined: Jun 2007
QUOTE(tgrrr @ Aug 12 2009, 06:20 PM)
I don't know if the kind of programmable IC you're looking for exists.
You can make your own simple audio player using micro-controllers like PIC, but you'll need to write the whole program, not just the song you wanted to play.
*
It exist, example: http://www.rev-ed.co.uk/picaxe/
This one can only program for monophonic ringtone.

But I wonder where can I find it in Malaysia. Especially those that can record full song.
Aurora
post Aug 12 2009, 10:35 PM

On my way
****
Senior Member
630 posts

Joined: Jan 2003


QUOTE(e-fatty @ Aug 12 2009, 01:02 PM)
So that means its easiest to get the converter straight rather than writing a UART prog in PIC?

The problem is i'm from Perlis and its hard to get these kinda stuff....


Added on August 12, 2009, 1:05 pm

Yeah i'm learning it through LED, sensors and Motors. Last sem we used assembly but now we're learning in C.
*

Yup, as the guide suggested, it was meant to connect directly from hdd to com port. Rewriting the entire code is just messy. sweat.gif Since com port can communicate directly via hyperterminal on XP, (which is sweet), just follow the guide and you won't be wrong. The only thing you need to figure out is to either buy the same converter (recommended), or you need to figure out the right chip and circuit. Try to look around for the circuit (check the chip datasheet in used for the said converter, and look for the application note). Try look around Perlis first. Just let me know if you can't find the chip there, I can buy for you, provided it's not urgent. wink.gif (I usually go there once a month to pick up some component for my project)


QUOTE(fantasy1989 @ Aug 12 2009, 01:06 PM)
can anyone teach me how to control stepper motor with using parallel port? newbie for electronics ..need for my final year project ...=)

thanks
*

QUOTE(fantasy1989 @ Aug 12 2009, 07:53 PM)
my project is using computer to control stepper motor ...via parallel port ...any sample program? ..i wanna make it like door OPEN n CLOSE (slide)
*

Erm, aren't you suppose to do some research first before asking? sweat.gif laugh.gif Since it's FYP, some people are willing to do it for you, at a price of course. brows.gif brows.gif jk laugh.gif

Anyway, which stepper motor are you using? i.e. the rating, spec, etc. I think parallel port is phasing out slowly, not sure if the new motherboard still got or not. I trust that your PC still have it. There are abundance of for communicating using parallel port. Cause we don't know what is your level and application, I think best if you google first, find a nice guide that really suit your need, and try to read first. If you still can't understand, post here and we are glad to help.

QUOTE(jiaxun @ Aug 12 2009, 03:40 PM)
Hi,

I would like to make something like a birthday song card, but the birthday song is replaced by the song of my choice.

Does anybody knows where can I get such a programmable IC and how to program it? Besides, I would like a guide on how to make that circuit.

Thank you.
*

Depends on your audio quality, a very simple song (i.e. bepper type, sound quality is like dinosour-age nokia 3310 ringtone) can be produce with just a programmable micro-controller, the smallest and cheapest one is probably around RM10 (check lelong.com.my), not much component require. But the chip is quite big la, you can't really get those small circuit like they sell in bookstore. If you want better quality, like MP3 (i.e. instrument with you singing the song).... sweat.gif That one more expensive, you need to get a MP3 encoder/decoder chip. Even I haven't play with that before. You can try google DIY MP3 circuit. This idea is best if you want to make a customize music box, cause the circuit+battery itself is just no sense to put onto a card... laugh.gif laugh.gif

epit3036
post Aug 13 2009, 02:17 AM

New Member
*
Newbie
1 posts

Joined: Feb 2009
From: Shah Alam


i need help...
i want to make a pic program that use PIC16F873...
for tracking maximum power point tracker (MPPT)..
the input is PV (solar)..
so the program should can compare the voltage and current so that
it can delivered the maximum power point..
anybody can help me
jiaxun
post Aug 13 2009, 07:11 AM

- Wh@†Eve® - ™
******
Senior Member
1,352 posts

Joined: Jun 2007
QUOTE(Aurora @ Aug 12 2009, 10:35 PM)
Depends on your audio quality, a very simple song (i.e. bepper type, sound quality is like dinosour-age nokia 3310 ringtone) can be produce with just a programmable micro-controller, the smallest and cheapest one is probably around RM10 (check lelong.com.my), not much component require. But the chip is quite big la, you can't really get those small circuit like they sell in bookstore. If you want better quality, like MP3 (i.e. instrument with you singing the song)....  sweat.gif That one more expensive, you need to get a MP3 encoder/decoder chip. Even I haven't play with that before. You can try google DIY MP3 circuit. This idea is best if you want to make a customize music box, cause the circuit+battery itself is just no sense to put onto a card...  laugh.gif  laugh.gif
*
Yes this is what I'm talking about. I searched lelong but only got 1 type which is 18-pins. I think 8 or 16 pints will be enough?
tgrrr
post Aug 13 2009, 10:58 AM

Enthusiast
*****
Senior Member
939 posts

Joined: Jan 2003
From: Penang
QUOTE(jiaxun @ Aug 12 2009, 09:33 PM)
It exist, example: http://www.rev-ed.co.uk/picaxe/
This one can only program for monophonic ringtone.

But I wonder where can I find it in Malaysia. Especially those that can record full song.
*
I can't open the picaxe website. But anyway, those are using PIC controllers. You can achieve the same thing by building your own controller board and writing your own code, provided you know how to do that. I've never tried them but the higher end 16-bit PIC has DSP for advance sound processing.

Or are you looking for a finished product? A quick google search shows this -->Some stuff. Looks like something you're looking for but I've no idea on the cost.


Added on August 13, 2009, 11:00 am
QUOTE(epit3036 @ Aug 13 2009, 02:17 AM)
i need help...
i want to make a pic program that use PIC16F873...
for tracking maximum power point tracker (MPPT)..
the input is PV (solar)..
so the program should can compare the voltage and current so that
it can delivered the maximum power point..
anybody can help me
*
that really sounds like a FYP.


Added on August 13, 2009, 12:05 pm
QUOTE(jiaxun @ Aug 13 2009, 07:11 AM)
Yes this is what I'm talking about. I searched lelong but only got 1 type which is 18-pins. I think 8 or 16 pints will be enough?
*
Oh I didn't know you just want some beeping music. I'm thinking using PIC to generate PWMs at the frequency of music "note" will do the job. Then you just need some driver circuit for the speaker.

This post has been edited by tgrrr: Aug 13 2009, 12:05 PM
epit3036
post Aug 13 2009, 12:50 PM

New Member
*
Newbie
1 posts

Joined: Feb 2009
From: Shah Alam


yup.. this is my FYP
Aurora
post Aug 13 2009, 09:46 PM

On my way
****
Senior Member
630 posts

Joined: Jan 2003


QUOTE(epit3036 @ Aug 13 2009, 02:17 AM)
i need help...
i want to make a pic program that use PIC16F873...
for tracking maximum power point tracker (MPPT)..
the input is PV (solar)..
so the program should can compare the voltage and current so that
it can delivered the maximum power point..
anybody can help me
*

QUOTE(epit3036 @ Aug 13 2009, 12:50 PM)
yup.. this is my FYP
*
Bro, FYP is meant to work by yourself le.... We can help on trouble-shooting, i.e. share with you which ingredient is the best to prepare the meal, but don't come and ask us to feed you le... shakehead.gif sweat.gif Seriously, I'm also dead lazy to search for the literature on how to do it. laugh.gif Go google, and if you find some link that you can't understand, post here and we will guide you. wink.gif


QUOTE(jiaxun @ Aug 13 2009, 07:11 AM)
Yes this is what I'm talking about. I searched lelong but only got 1 type which is 18-pins. I think 8 or 16 pints will be enough?
*
Any pin count will do, you don't need all the pins. But need to check the internal memory. I haven't write a music program file before, my guess is even the smallest size will do. biggrin.gif Like tgrrr said, just engage the PWM, then change the duty factor and you can get your music already. See if I'm free to do a simple demo or not this weekend. biggrin.gif First need to get a beeper/speaker, maybe steal from my PC casing.
jiaxun
post Aug 14 2009, 08:05 AM

- Wh@†Eve® - ™
******
Senior Member
1,352 posts

Joined: Jun 2007
QUOTE(tgrrr @ Aug 13 2009, 10:58 AM)
Oh I didn't know you just want some beeping music. I'm thinking using PIC to generate PWMs at the frequency of music "note" will do the job. Then you just need some driver circuit for the speaker.
*
QUOTE(Aurora @ Aug 13 2009, 09:46 PM)
Any pin count will do, you don't need all the pins. But need to check the internal memory. I haven't write a music program file before, my guess is even the smallest size will do.  biggrin.gif Like tgrrr said, just engage the PWM, then change the duty factor and you can get your music already. See if I'm free to do a simple demo or not this weekend.  biggrin.gif First need to get a beeper/speaker, maybe steal from my PC casing.
*
Actually, what is/are the difference(s) between IC and PIC

Sorry I am totally not related to this E&E field but only know some basics, hope you guys can help me out on this. Thanks.
tgrrr
post Aug 14 2009, 12:01 PM

Enthusiast
*****
Senior Member
939 posts

Joined: Jan 2003
From: Penang
There are types of IC. Many have specialized functions like the Max232 converter or some audio encoder/decoder.
Other are basic building blocks to allow the forming of larger circuitry i.e. logic IC or opamps.

PIC is a brand of microcontrollers which in turn is a type of IC.
Microcontrollers contain a tiny cpu (similar but generally much weaker to the one in a pc), and allows user to program it for a variety of tasks.
Thus you'll need some programming knowledge, and some hardware to 'program' it.


Added on August 14, 2009, 12:16 pm
QUOTE(fantasy1989 @ Aug 12 2009, 07:53 PM)
my project is using computer to control stepper motor ...via parallel port ...any sample program? ..i wanna make it like door OPEN n CLOSE (slide)
*
QUOTE(epit3036 @ Aug 13 2009, 02:17 AM)
i need help...
i want to make a pic program that use PIC16F873...
for tracking maximum power point tracker (MPPT)..
the input is PV (solar)..
so the program should can compare the voltage and current so that
it can delivered the maximum power point..
anybody can help me
*
It would be far more helpful if you guys first list out,
1. Your level of skills and experiences in programming and electronics -> e.g. if you've build a 5vdc power supply before...
2. Your project overall design architecture -> simple but concise descriptions with or without diagrams. Schematics and code snippets if you had one.
3. Your project current general status -> what's working, what's not working yet...
4. What you're stuck with -> Give as much details as possible of what you've tried and the results.

This will save us a lot of time figuring out what's your problem and how to help you.
Note we do expect a significant amount of effort and responsibility from your side.

This post has been edited by tgrrr: Aug 14 2009, 12:16 PM

35 Pages « < 16 17 18 19 20 > » Top
 

Change to:
| Lo-Fi Version
0.0295sec    0.44    6 queries    GZIP Disabled
Time is now: 30th November 2025 - 10:48 AM