Simple project help me!!!

Status
Not open for further replies.

ryusgnal

Advanced Member level 4
Joined
Oct 4, 2005
Messages
102
Helped
3
Reputation
6
Reaction score
1
Trophy points
1,298
Location
Malaysia
Visit site
Activity points
1,992
Hi i'm newbies in PIC design. I want to built simple project for exercise. I'm using PIC16F877a for this project.

I want to PIC to read data from serial port which i send from hiperterminal. then PIC will XOR the data with '11111111' and send it back to serial port. and i can see the output in hiperterminal. does anybody know the code in C language?

thank you for any help.
 

ryusgnal,

I have some codes writen in C++Builder 5.03 working with serial port, but it do not exactly what you want, instead, it work under a proprietary frame protocol. If you want it, I may send to you, or post here. You choice.


+++
 

Code:
#use delay (clock=20000000)
#use rs232(baud=9600, xmit=PIN_C6,rcv=PIN_C7)

void main(void)
{
  while (1)
  {
     putc(~getc());
  }
}




the magic of ccs pic c compiler....

edit: sorry, i think it was 1-complement... but this is the xor version
Code:
#use delay (clock=20000000)
#use rs232(baud=9600, xmit=PIN_C6,rcv=PIN_C7)

void main(void)
{
  while (1)
  {
     putc(getc() ^ 0b11111111);
  }
}
 

Go to Oshonsoft.com and download Pic_Simulator_IDE. This software includes a Basic compiler which generates assembly and hex code. This code can be programmed into a 16F877A or you can use the Bootloader you will find on the site. Or if you like you can run a simulation. Try it it is.
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…