uart bit banging

Status
Not open for further replies.
Post what you've got.... I'll see what's up.... If you don't want it seen by many, then PM me...
 
not really any code specifically , just a working example of how to insert asm,

XC8 btw...

Code:
int main(int argc, char** argv)
{   
while (1){
#asm
   movlw 0x17
   movwf  Count
#endasm
}
}
 
Right! Well first off embedded main() has no parameters..... its void.

void main(void).. Reason... PC programs can be run with parameters and switches and embedded programs can not..

Funny thing is... That pic16's require the main to have no return, but pic18's do require a return... Weird as both do not need a return!!!

Count must be declared global and asm must use the underscore to access it.

C:
char Count;
void main(void)
   { 
   while (1)
      {
      #asm
           movlw 0x17
           movwf _Count
      #endasm
      }
  }
 
I often wondered that about calling main, I realize that there is not much parameters being passed in to main, and not much to return to... I meant to ask if there was something that may get&set those values but never got around to it,
I found it in a web example, however it has never caused a build error,

got it, count is Global!
 
There is a way to use local variables but I didn't check that out..
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…