Transistorman
Member
Anyone here know how to receiving string from pc to PIC
here is latest code that i get
but it is not code for PIC
and Visual Basic Code
for The Transmitter
The DLL file is downloadable at internet
just search Mr_Widodo.dll
The C code at above is writen using AVR codevision C
anyone can help me to rewrite the code for PIC ?
here is latest code that i get
but it is not code for PIC
Code:
//Le Creusot- France, 21 November 2007
#include <mega16.h>
#include <delay.h>
flash unsigned char string[]={0x80,0xC0,0x40,0x60,0x20,0x30,0x10,0x90};
void main(void) {
unsigned char i; unsigned char data;
UCSRA=0x00; //konfigurasi baud rate 9600bps
UCSRB=0x18;
UCSRC=0x86;
UBRRH=0X00;
UBRRL=0X19;
PORTD=0xFF;
DDRD=0xF0; //PD4-PD7 sebagai output
i=1;
while (1) {
while (UCSRA.7) //Apakah ada data baru yang belum dibaca
{
data=UDR;
PORTB=data; // data dikirim ke Port B
}
if (data==’a’) //Jika karakter a dikirim,
{ // maka motor stepper berputar CW half step
i--;
if (i==0xFF) i=7;
PORTD=string[i];
}
if(data==’b’) //Jika karakter b dikirim,
{ //motor stepper berputar CCW half step
…
}
delay_ms(100); //Untuk bouncing saklar
PORTD=0; //Nilai logika stepper = '0'
};
}
and Visual Basic Code
for The Transmitter
Code:
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
tampilkanport()
Dim about As New Mr_Widodo.KomunikasiSerial
Label3.Text = about.DisplayPembuat
End Sub
…
Private Sub btnPutarKiri_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPutarKiri.Click
Dim Serial As New Mr_Widodo.KomunikasiSerial ‘buat objek
Serial.KirimDataSerial("a", cbPort.Text) ‘Putar kiri
End Sub
Private Sub btnPutarKanan_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim Serial As New Mr_Widodo.KomunikasiSerial
Serial.KirimDataSerial("b", cbPort.Text) ‘Putar Kanan
End Sub
End Class
The DLL file is downloadable at internet
just search Mr_Widodo.dll
The C code at above is writen using AVR codevision C
anyone can help me to rewrite the code for PIC ?