SK40B..&rs 232..transfer data from pic to pc

Discussion about projects that used PIC Microcontroller, Hardware Interface, Programming Algorithm and etc......

Re: SK40B..&rs 232..transfer data from pic to pc

Postby sarra » Thu Jan 27, 2011 4:36 pm

Where should i start?Actually i dont understand the concept.I'm just learn lot of theory and this is my first time doing this.
Ok,let say,i make a program for blinking LED to my PIC18F452.How can i transfer the data from my pic to my pc using RS232?
cOULD SOMEONE HELP ME?And guide me where should i study?Im really blurr at all
sarra
Newbie
 
Posts: 9
Joined: Sat Jan 22, 2011 12:36 pm

Re: SK40B..&rs 232..transfer data from pic to pc

Postby sarra » Thu Jan 27, 2011 8:16 pm

OK..this is simple blinking led..
I want to make a coding for UART..
what the error?
Could anybody help me?

#include <p18f452.h>
#include <sw_uart.h>

// Configuration bits for PIC18F452 chip with a 20MHz crystal. It sets the following configuration:
// Debug OFF, Oscillator in HS mode with PLL enabled (40Mhz clock), Watchdog timer off, Extended CPU mode off
#pragma config OSC = HS //HS with 4 x PLL enabled - clock is speed of crystal x 4
#pragma config WDT = OFF //Watchdog timer can be enabled in software with SWDTEN bit
#pragma config LVP = OFF //Low voltage programming disabled

int main()
{
/* Set PORT D as digital outputs */
LATC = 0x00;
TRISC = 0x00;

char data;
// configure software UART
OpenUART();

while(1)

{
/* Turn on LED, D1 */
LATCbits.LATC7 = 1;

/* Delay for 500 milliseconds */
Delay10KTCYx(10000000);

/* Turn off LED, D1 */
LATCbits.LATC7 = 0;

/* Delay for 500 milliseconds */
Delay10KTCYx(10000000);

data = ReadUART(); //read a byte
WriteUART( data ); //bounce it back
}

}
sarra
Newbie
 
Posts: 9
Joined: Sat Jan 22, 2011 12:36 pm

Re: SK40B..&rs 232..transfer data from pic to pc

Postby ABSF » Fri Jan 28, 2011 10:13 am

sarra WROTE:OK..this is simple blinking led..
I want to make a coding for UART..
what the error?
Could anybody help me?

#include <p18f452.h>
#include <sw_uart.h>

...............clip off................

data = ReadUART(); //read a byte
WriteUART( data ); //bounce it back
}

}


Forget about the C program that you're writing for interfacing your LEDs and pushbuttons to VB or C# first.

First, you PIC must be able to detect switches and on/off LED. (completed)
Second, Are you able to send chars A to Z to PC using Hyperterminals?
Third, is you PIC able to receive chars from the PC's hyperterminal and display them on LCD?

Once the above 3 thing are working, then you can devise a way to make you PIC to send the status of Inputs and outputs to your VB or C# in PC.

Take a look at the discussions here to get some ideas. We cannot provide the exact solution for you, as we are also as busy as you are. So pointers are what the best we can afford.

http://forum.best-microcontroller-proje ... ions#p2706

Did you search all the past threads in cytron using the search key "RS232"? You'll be surprise what you can find there.

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: SK40B..&rs 232..transfer data from pic to pc

Postby ABSF » Fri Jan 28, 2011 10:24 am

Here is one more good discussion I just found.

http://forum.allaboutcircuits.com/showt ... 237&page=1

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: SK40B..&rs 232..transfer data from pic to pc

Postby sarra » Fri Jan 28, 2011 12:06 pm

Thank you for your helping.
I will study hard and will ask again if i meet any difficulties.
Thanks again
sarra
Newbie
 
Posts: 9
Joined: Sat Jan 22, 2011 12:36 pm

Previous

Return to PIC Microcontroller

Who is online

Users browsing this forum: No registered users and 4 guests

cron