sdcc

8051 development on Fedora

Monday, September 6th, 2010 | Fedora, FOSS, Tutorial | 2 Comments

First install sdcc

#yum install sdcc

Next is a small example to blink a LED connected to P1.7


#include <8051.h>
void main(void)
{
int i=1;
P1=0; /* P1.7 used as LED output */
while(1)
{
P1_7=!(P1_7); /* toggle P1.7*/

for(i=1;i<25000;i++);
/* for delay */

}
}

Compile it and get the hex file from intel hex

$sdcc-sdcc blink.c
$ sdcc-packihx blink.ihx > blink.hex

Now you can upload the hex to the programmer :D /me is also just starting up.

Tags: , ,

Search

Archives

Categories