Programming DS89C450 - Linux

josip

Joined Mar 6, 2014
67
Ok, now I'm using Assembly to perform a few actions in the uC.

My next challenge is to write a small and simple code to make the uC react to 4 control signals.
I have 8 LEDs connected to Port 1.

Te challenge is:

If P0.0 is "1", then all LEDs must turn ON and turn OFF
If P0.1 is "1", then one LED must turn ON and rotate left (RL instruction in Assembly)
If P0.2 is "1", then one LED must turn ON and rotate right (RR instruction in Assembly)
If P0.3 is "1", then the 2 middle LEDs must turn ON and one rotates left and the other one rotates right, so 2 LEDs will be working.

I have part of the code done and part of that part is working but the other part is not working.

But for now I need help to build the code to P0.3.
Any hits?
Copy old LED state to accumulator, mask (ANL) lower 4 bits and rotate in one direction, mask upper 4 bits and rotate in another direction. Combine both results (ORL) and store it to LED port.
 

Thread Starter

PsySc0rpi0n

Joined Mar 4, 2014
1,763
Hi again...

I don't know why, my MCU 8051 IDE is not compilling my C code anymore. And it was before... I have already installed the latest version of SDCC and added bin folder to Windows PATH variable. (I'm at work and I only have Windows here).

I doing an include of the 8051 header file and when I try to compile any code I get the following:

Code:
Starting compiler ...

cd "C:\Users\AM06\Desktop\Nova pasta\uControladores\Teste"
sdcc -mmcs51 --iram-size 256 --xram-size 0 --code-size 8192  --nooverlay --noinduction --verbose --debug -V --std-sdcc89 --model-small   "teste.c"
sdcc: Calling preprocessor...
+ C:PROGRA~1SDCCbinsdcpp.exe -nostdinc -Wall -obj-ext=.rel -D__SDCC_NOOVERLAY -DSDCC_NOOVERLAY -D__SDCC_MODEL_SMALL -DSDCC_MODEL_SMALL -D__SDCC_FLOAT_REENT -DSDCC_FLOAT_REENT -D__SDCC=3_4_1 -DSDCC=341 -D__SDCC_REVISION=9090 -DSDCC_REVISION=9090 -D__SDCC_mcs51 -DSDCC_mcs51 -D__mcs51 -D__STDC_NO_COMPLEX__ -D__STDC_NO_THREADS__ -D__STDC_NO_ATOMICS__ -D__STDC_NO_VLA__ -isystem "C:Program FilesSDCCbin..includemcs51" -isystem "C:Program FilesSDCCbin..include"  "teste.c"
sdcc: Generating code...
sdcpp.exe: fatal error: when writing output to : No error
../Trab-1/sdcc_reg_4xx.h:15: syntax error: token -> 'at' ; column 6

Compilation FAILED
The header file has the following code

Code:
/*
* sdcc_reg420.h
*
* MAXIM INTEGRATED PRODUCTS
*
* Special Function Register definitions file
* DS89C430/450 Ultra-High Speed 8051-compatible uCs
*
*/

#ifndef __REG420_H__
#define __REG420_H__

/*  BYTE Registers  */
sfr at 0x80 P0;
sfr at 0x81 SP;
sfr at 0x82 DPL;
sfr at 0x83 DPH;
sfr at 0x84 DPL1;
sfr at 0x85 DPH1;
sfr at 0x86 DPS;
sfr at 0x87 PCON;
sfr at 0x88 TCON;
sfr at 0x89 TMOD;
sfr at 0x8A TL0;
sfr at 0x8B TL1;
sfr at 0x8C TH0;
sfr at 0x8D TH1;
sfr at 0x8E CKCON;
sfr at 0x90 P1;
sfr at 0x91 EXIF;
sfr at 0x96 CKMOD;
sfr at 0x98 SCON0;
sfr at 0x99 SBUF0;
sfr at 0x9D ACON;
sfr at 0xA0 P2;
sfr at 0xA8 IE;
sfr at 0xA9 SADDR0;
sfr at 0xAA SADDR1;
sfr at 0xB0 P3;
sfr at 0xB1 IP1;
sfr at 0xB8 IP0;
sfr at 0xB9 SADEN0;
sfr at 0xBA SADEN1;
sfr at 0xC0 SCON1;
sfr at 0xC1 SBUF1;
sfr at 0xC2 ROMSIZE;
sfr at 0xC4 PMR;
sfr at 0xC5 STATUS;
sfr at 0xC7 TA;
sfr at 0xC8 T2CON;
sfr at 0xC9 T2MOD;
sfr at 0xCA RCAP2L;
sfr at 0xCB RCAP2H;
sfr at 0xCC TL2;
sfr at 0xCD TH2;
sfr at 0xD0 PSW;
sfr at 0xD5 FCNTL;
sfr at 0xD6 FDATA;
sfr at 0xD8 WDCON;
sfr at 0xE0 ACC;
sfr at 0xE8 EIE;
sfr at 0xF0 B;
sfr at 0xF1 EIP1;
sfr at 0xF8 EIP0;

/* BIT Registers  */

/* P0 */
sbit at 0x80 P0_0;
sbit at 0x81 P0_1;
sbit at 0x82 P0_2;
sbit at 0x83 P0_3;
sbit at 0x84 P0_4;
sbit at 0x85 P0_5;
sbit at 0x86 P0_6;
sbit at 0x87 P0_7;

/* TCON */
sbit at 0x88 IT0;
sbit at 0x89 IE0;
sbit at 0x8A IT1;
sbit at 0x8B IE1;
sbit at 0x8C TR0;
sbit at 0x8D TF0;
sbit at 0x8E TR1;
sbit at 0x8F TF1;

/* P1 */
sbit at 0x90 P1_0;
sbit at 0x91 P1_1;
sbit at 0x92 P1_2;
sbit at 0x93 P1_3;
sbit at 0x94 P1_4;
sbit at 0x95 P1_5;
sbit at 0x96 P1_6;
sbit at 0x97 P1_7;

/* SCON0 */
sbit at 0x98 RI_0;
sbit at 0x99 TI_0;
sbit at 0x9A RB8_0;
sbit at 0x9B TB8_0;
sbit at 0x9C REN_0;
sbit at 0x9D SM2_0;
sbit at 0x9E SM1_0;
sbit at 0x9F SM0_0;
sbit at 0x9F FE_0;

/* P2 */
sbit at 0xA0 P2_0;
sbit at 0xA1 P2_1;
sbit at 0xA2 P2_2;
sbit at 0xA3 P2_3;
sbit at 0xA4 P2_4;
sbit at 0xA5 P2_5;
sbit at 0xA6 P2_6;
sbit at 0xA7 P2_7;

/* IE */
sbit at 0xA8 EX0;
sbit at 0xA9 ET0;
sbit at 0xAA EX1;
sbit at 0xAB ET1;
sbit at 0xAC ES0;
sbit at 0xAD ET2;
sbit at 0xAE ES1;
sbit at 0xAF EA;

/* P3 */
sbit at 0xB0 P3_0;
sbit at 0xB1 P3_1;
sbit at 0xB2 P3_2;
sbit at 0xB3 P3_3;
sbit at 0xB4 P3_4;
sbit at 0xB5 P3_5;
sbit at 0xB6 P3_6;
sbit at 0xB7 P3_7;

/* IP0 */
sbit at 0xB8 LPX0;
sbit at 0xB9 LPT0;
sbit at 0xBA LPX1;
sbit at 0xBB LPT1;
sbit at 0xBC LPS0;
sbit at 0xBD LPT2;
sbit at 0xBE LPS1;

/* SCON1 */
sbit at 0xC0 RI_1;
sbit at 0xC1 TI_1;
sbit at 0xC2 RB8_1;
sbit at 0xC3 TB8_1;
sbit at 0xC4 REN_1;
sbit at 0xC5 SM2_1;
sbit at 0xC6 SM1_1;
sbit at 0xC7 SM0_1;

/* T2CON */
sbit at 0xC8 CP_RL_2;
sbit at 0xC9 C_T_2;
sbit at 0xCA TR_2;
sbit at 0xCB EXEN_2;
sbit at 0xCC TCLK;
sbit at 0xCD RCLK;
sbit at 0xCE EXF_2;
sbit at 0xCF TF_2;

/* PSW */
sbit at 0xD0 PARITY;
sbit at 0xD0 P;
sbit at 0xD1 F1;
sbit at 0xD2 OV;
sbit at 0xD3 RS0;
sbit at 0xD4 RS1;
sbit at 0xD5 F0;
sbit at 0xD6 AC;
sbit at 0xD7 CY;

/* WDCON */
sbit at 0xD8 RWT;
sbit at 0xD9 EWT;
sbit at 0xDA WTRF;
sbit at 0xDB WDIF;
sbit at 0xDC PFI;
sbit at 0xDD EPFI;
sbit at 0xDE POR;
sbit at 0xDF SMOD_1;

/* EIE */
sbit at 0xE8 EX2;
sbit at 0xE9 EX3;
sbit at 0xEA EX4;
sbit at 0xEB EX5;
sbit at 0xEC EWDI;

/* EIP0 */
sbit at 0xF8 LPX2;
sbit at 0xF9 LPX3;
sbit at 0xFA LPX4;
sbit at 0xFB LPX5;
sbit at 0xFC LPWDI;

#endif
I have always used this file and now it is returning errors!
Any help???
 

Thread Starter

PsySc0rpi0n

Joined Mar 4, 2014
1,763
Well, hope I can get some help in the next posts of mine!

I'm developing a small game to one of my graduation classes using an 8051 compatible micro controller (the one in the thread title).
The game consists in a bullet going towards a person (custom character in LCD CGRAM). Among other features, I need to handle the characters's motion in C programming.

At this point I have the "man" at the left upper corner of the LCD and the bullet at the opposite corner. And I need to know how to make the bullet to move towards the "man".

Any ideas?
 
Top