8051

What techniques are available for memory optimizing in 8051 assembly language?

I need to optimize code to get room for some new code. I do not have the space for all the changes. I can not use code bank switching (80c31 with 64k). ...

How do I mark code with side effects?

I'm working on a project on an 8051 where every byte counts. As such, I am using some global variables where I normally wouldn't. The normal method of passing pointers into a function adds too much overhead here. I have a number of functions that use single bit variables (a compiler specific extension to C) to signal the outcome of a ...

C++ for 8051 microcontroller?

Hi all, Could someone please tell me if it's possible to burn an 8051 microcontroller with a C++ program? I've tried searching about it online but can't seem to find out for sure if it's possible or not. Keil uses C, but the program I need to write is very string-intensive and C is quite string-unfriendly as compared to C# which is wha...

What is the best C compiler for the 8051 family?

We are starting a new project based on an 8051 microcontroller. Questions: What is the best C compiler to use? Are there any open source 8051 compilers and how good are they? ...

Unravelling Assembly Language Spaghetti Code

I've inherited a 10K-line program written in 8051 assembly language that requires some changes. Unfortunately it's written in the finest traditions of spaghetti code. The program--written as a single file--is a maze of CALL and LJMP statements (about 1200 total), with subroutines having multiple entry and/or exit points, if they can be i...

Interface usb to 89s52 ( 8051 ) microcontroller

How do i interface an usb to microcntroller 89s52 ? can i get the circuit diagram itself ? And also the logic behind the transmission and reception of bits ? Thnxx ...

How can I send a string serially from an 8051 only ONCE?

Hello everyone, I am making an 8051 microcontroller communicate wirelessly with a computer. The microcontroller will send a string to its serial port (DB9) and the computer will receive this string and manipulate it. My problem is that I do not know how to make the 8051 transmit the string just once. Since I need to manipulate the st...

How do I continuously send and receive with wireless serial-port in 8051?

Hello everyone! I'm trying to make a microcontroller communicate with a program on my desktop. I'm using serial port connections with Xbee radios on both ends. The communication works fine when I send something from the microcontroller to the desktop and the program on the desktop then sends something back to the microcontroller. Ho...

Micro-controller 8051: How to get addresses of inputs to JB & CJNE instructions?

I'm implementing whole set of 8051 instructions in VHDL from scratch. Most of things went well but stumbled on these 2 instructions: JB bit,rel 00100000 bit_address rel_address CJNE A,#data,rel 10110100 immediate_data rel_address Any help or hint is greatly appreciated. Thank you in advance! ...

How to make 8051 emulator

For learning purpose i intend to start building a 8051 microcontroller emulator. I am comfortable programming in C/C++/C#. This is no class project etc but a learning initiative from my side. I did found quite a lot of questions discussing this. However, I wanted to break it bit more on a granular level so that I can know which areas I ...

When do I use xdata?

I am new at embedded system programming. I am working on a device that uses an 8051 chipset. I have noticed in the sample programs that when defining variables, sometimes they use the keyword xdata. like this... static unsigned char xdata PatternSize; while other times the xdata keyword is omitted. My understanding is that the xdata k...

What is wrong with this arithmetic when using SDCC (Little Endian) Compiler?

I am very new at C programming and I am working on a firmware application for my MCU. This method was working fine when I was using the KEIL compiler (Big Endian) but when I switched to the SDCC compiler (Little Endian) it is not working properly. Can someone please explain what I am doing wrong??? The target device is a Silicon Labs C8...

[8051 microcontroller] sleep

I'm supposed to write a program that will send some values to registers, then wait one second, then change the values. The thing is, I'm unable to find the instruction that will halt operations for one second. ...

Do all C compilers allow functions to return structures?

I am working on a program in C and using the SDCC compiler for a 8051 architecture device. I am trying to write a function called GetName that will read 8 characters from Flash Memory and return the character array in some form. I know that it is not possible to return an array in C so I am trying to do it using a struct like this: //*...

Why does using a structure in C program cause Link error

I am writing a C program for a 8051 architecture chip and the SDCC compiler. I have a structure called FilterStructure; my code looks like this... #define NAME_SIZE 8 typedef struct { char Name[NAME_SIZE]; } FilterStructure; void ReadFilterName(U8 WheelID, U8 Filter, FilterStructure* NameStructure); int main (void) { FilterStru...

What is the difference between AT89C51 and AT89S51?

How do you connect these to your computer? Which one would be easier to burn? ...

does 8-bit processor have to face endianness problem?

If I have a int32 type integer in the 8-bit processor's memory, say, 8051, how could I identify the endianess of that integer? Is it compiler specific? I think this is important when sending multybyte data through serial lines etc. ...

Ways to divide the high/low byte from a 16bit address?

Hello, I'm developing a software on 8051 processor. A frequent job is to divide the high and low byte of a 16bit address. I want to see there are how many ways to achieve it. The ways I come up so far are: (say ptr is a 16bit pointer, and int is 16bit int) [note the rn and arn is registers] bitwise operation ADDH = (unsigned int) ptr ...

What is the fastest way to do division in C for 8bit MCUs?

I am working on the firmware for a device that uses an 8bit mcu (8051 architecture). I am using SDCC (Small Device C Compiler). I have a function that I use to set the speed of a stepper motor that my circuit is driving. The speed is set by loading a desired value into the reload register for a timer. I have a variable, MotorSpeed that ...

8051 external interrupt

how to enable external interrupt of 8051? ...