Hallo, ich habe ein komisches Problem. Ich möchte gerne mit dem PIC über die RS232 schnittstelle die BIT Folge 808080800D ausgeben.Als Übertragungrate habe ich 9600 Baud, 1 Stopbit,Parity none. Wenn ich den Prozessor an ein Terminal anschliesse wird mir das auch ohne Probleme angezeit. Mess ich mit dem Oszi, kommt nur Müll raus. Kann mir da jemand helfen? #include <16F887.h> //Compiler Directives ------------------------------------------------------------------------ - #FUSES NOWDT //No Watch Dog Timer #FUSES XT //External XTAL #FUSES NOPUT //No Power Up Timer #FUSES NOPROTECT //Code not protected from reading #FUSES NODEBUG //No Debug mode for ICD #FUSES NOBROWNOUT //No brownout reset #FUSES NOLVP //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O #FUSES NOCPD //No EE protection #FUSES NOWRT //Program memory not write protected #use delay(clock=4000000) #use rs232(baud=9600,parity=n,bits=8,stop=1,xmit=pin_c6,RCV=pin_c7) #define IN_OUT PIN_B0 #define S500 PIN_B1 #define S501 PIN_B2 #define S502 PIN_B3 #define S503 PIN_B4 int data0[5]; void main(void) { while(1) { data0[0]=0x80; data0[1]=0x80; data0[2]=0x80; data0[3]=0x80; data0[4]=0x0D; printf("%x",data0[0]); delay_ms(1); printf("%x",data0[1]); delay_ms(1); printf("%x",data0[2]); delay_ms(1); printf("%x",data0[3]); delay_ms(1); printf("%x",data0[4]); delay_ms(1); } }
> Wenn ich den Prozessor an ein Terminal anschliesse wird mir das auch > ohne Probleme angezeit. Dann funktioniert das Programm also? > Mess ich mit dem Oszi, kommt nur Müll raus. Müll?
Habe den Fehler gefungen. Ich Übertrage den HEX wert im printf Befehlt als HEX zahl, muss diesen aber als Char übertragen
Bitte melde dich an um einen Beitrag zu schreiben. Anmeldung ist kostenlos und dauert nur eine Minute.
Bestehender Account
Schon ein Account bei Google/GoogleMail? Keine Anmeldung erforderlich!
Mit Google-Account einloggen
Mit Google-Account einloggen
Noch kein Account? Hier anmelden.