Welcome Guest ( Log In | Register )

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
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
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.

 

Change to:
| Lo-Fi Version
0.0210sec    0.62    7 queries    GZIP Disabled
Time is now: 9th December 2025 - 05:05 PM