Write from a pic18f to matlab

how would you write a pic program in picc18 compiler for a pic18f4431 in mplab to send the letters ‘G’ and 'A' to matlab at 9600 bps? All I can send with the code below is the letter 'K' a million times to matlab...

Thanks

#include
#include

void delay()
{

for (int j=0;j<30000;j++)
{
}

}


void main(void)
{
//int i=0;
//BAUDCTLbits.BRG16=0;
//SPBRG = 0b01000000;
TXSTA =0x24; // TX enable BRGH=1
TRISC=0b10000000; // RX
RCSTA=0x90; // continuous RX
delay();
while(1)
{

TXREG = 'K';
delay();
wait:
if(TXIF==0 )
{
goto wait;
}

break;
}



}//END MAIN

Replies

You are reading an archived discussion.

Related Posts

Hey Im new to interfacing on matlab and i would like to know what the following error means: ??? Error using ==> eq Array dimensions must match for binary array...
My PC is really not so good ,but i find that registry cleaner can do some help,here is what i used now,
hi. we are students of second year doing our electronics and communication engineering. we want to do a hardware project in the field mentioned above preferably with energy conservation. kindly...
We are constructing a new website for Mechanical Engineers. 😎 MECHANICAL ENGINEERING First page (home page) designing is completed and remaining pages are under construction. I request all of you...
I am a graduating college student in Instrumentation and control engineering technology. I needed a project regarding this and i don't have any idea in my mind. Can somebody help...