ADUC 845 support

General discussion on mikroPascal PRO for 8051.
Post Reply
Author
Message
veerabahu
Posts: 4
Joined: 15 Mar 2011 13:21

ADUC 845 support

#1 Post by veerabahu » 22 Mar 2011 15:32

Hello ,

I find that "Mikroc for 8051" does not support ADUC845 which is basically 8052 core .

Found this link helpful for creating one
http://www.mikroe.com/forum/viewtopic.php?f=62&t=25919

but i dont understand . Is there any tutor to create a processor ? . We have the defs as header file.

thanks in advance
veera

User avatar
filip
mikroElektronika team
Posts: 11874
Joined: 25 Jan 2008 09:56

Re: ADUC 845 support

#2 Post by filip » 24 Mar 2011 13:21

Hi,

Currently, there are no official tutors for supporting additional MCUs.
We will consider adding such feature to the compiler.

For now, you can look at the mentioned link and the Defs folder of the compiler in order to include your device into the compiler.

Regards,
Filip.

matrix
Posts: 203
Joined: 26 Jan 2006 07:21
Location: Bulgaria
Contact:

Re: ADUC 845 support

#3 Post by matrix » 26 Mar 2011 19:31

So... I'll try to help you.

At first, you need to tell the compiler addresses of SFR's.
SFR's addresses can be taken from datasheet pdf for the needed chip:

http://www.analog.com/static/imported-f ... 47_848.pdf

Now, for example, at page 56 of this document, we can see this:
PWMCON PWM Control SFR
SFR Address: AEH
Power-On Default: 00H
Bit Addressable: No
This mean, that this is a Special Function Register (SFR) for PWM Module controlling, named PWMCON and located at address $AE.
So, we will declare it like this:

Code: Select all

var
  PWMCON    : byte; absolute 0xAE; volatile; sfr;
Now, we can access this register from compiler:

Code: Select all

PWMCON := [byte];  //$00..$FF
PWMCON.bit_number := [bit];  //bit_number = 0..7; bit = 0..1
Every SFR, located at address which can be divided by 8, is bit addressable. So, for example at page 65 we see this:
SPICON—SPI Control Register
SFR Address: F8H
Power-On Default: 05H
Bit Addressable: Yes


And the register should be defined like this:

Code: Select all

var
  SPICON : byte; absolute $F8; volatile; sfr; bdata;
Do this for all registers find in datasheet and save in file %MCU_NAME%.mpas. Then we will proceed with memory map.

veerabahu
Posts: 4
Joined: 15 Mar 2011 13:21

Re: ADUC 845 support

#4 Post by veerabahu » 04 Apr 2011 12:08

Hello Matrix ,

Thank you so much for your help and advise :) ..and this is ADUC845.mpas ..please let me know how to proceed..thanks again !


unit ADUC845

var
P0 : byte; absolute 0x80; volatile; sfr; bdata ;
SP : byte; absolute 0x81; volatile; sfr;
DPL : byte; absolute 0x82; volatile; sfr;
DPH : byte; absolute 0x83; volatile; sfr;
DPP : byte; absolute 0x84; volatile; sfr;
PCON : byte; absolute 0x87; volatile; sfr;
TCON : byte; absolute 0x88; volatile; sfr; bdata ;
TMOD : byte; absolute 0x89; volatile; sfr;
TL0 : byte; absolute 0x8A; volatile; sfr;
TL1 : byte; absolute 0x8B; volatile; sfr;
TH0 : byte; absolute 0x8C; volatile; sfr;
TH1 : byte; absolute 0x8D; volatile; sfr;
P1 : byte; absolute 0x90; volatile; sfr; bdata ;
SCON : byte; absolute 0x98; volatile; sfr; bdata ;
SBUF : byte; absolute 0x99; volatile; sfr;
I2CDAT : byte; absolute 0x9A; volatile; sfr;
I2CADD : byte; absolute 0x9B; volatile; sfr;
T3FD : byte; absolute 0x9D; volatile; sfr;
T3CON : byte; absolute 0x9E; volatile; sfr;
EWAIT : byte; absolute 0x9F; volatile; sfr;
P2 : byte; absolute 0xA0; volatile; sfr; bdata ;
TIMECON : byte; absolute 0xA1; volatile; sfr;
HTHSEC : byte; absolute 0xA2; volatile; sfr;
SEC : byte; absolute 0xA3; volatile; sfr;
MIN : byte; absolute 0xA4; volatile; sfr;
HOUR : byte; absolute 0xA5; volatile; sfr;
INTVAL : byte; absolute 0xA6; volatile; sfr;
DPCON : byte; absolute 0xA7; volatile; sfr;
IE : byte; absolute 0xA8; volatile; sfr; bdata ;
IEIP2 : byte; absolute 0xA9; volatile; sfr;
PWMCON : byte; absolute 0xAE; volatile; sfr;
CFG845 : byte; absolute 0xAF; volatile; sfr;
P3 : byte; absolute 0xB0; volatile; sfr; bdata ;
PWM0L : byte; absolute 0xB1; volatile; sfr;
PWM0H : byte; absolute 0xB2; volatile; sfr;
PWM1L : byte; absolute 0xB3; volatile; sfr;
PWM1H : byte; absolute 0xB4; volatile; sfr;
SPH : byte; absolute 0xB7; volatile; sfr;
IP : byte; absolute 0xB8; volatile; sfr; bdata ;
ECON : byte; absolute 0xB9; volatile; sfr;
EDATA1 : byte; absolute 0xBC; volatile; sfr;
EDATA2 : byte; absolute 0xBD; volatile; sfr;
EDATA3 : byte; absolute 0xBE; volatile; sfr;
EDATA4 : byte; absolute 0xBF; volatile; sfr;
WDCON : byte; absolute 0xC0; volatile; sfr; bdata ;
CHIPID : byte; absolute 0xC2; volatile; sfr;
EDARL : byte; absolute 0xC6; volatile; sfr;
EDARH : byte; absolute 0xC7; volatile; sfr;
T2CON : byte; absolute 0xC8; volatile; sfr; bdata ;
RCAP2L : byte; absolute 0xCA; volatile; sfr;
RCAP2H : byte; absolute 0xCB; volatile; sfr;
TL2 : byte; absolute 0xCC; volatile; sfr;
TH2 : byte; absolute 0xCD; volatile; sfr;
PSW : byte; absolute 0xD0; volatile; sfr; bdata ;
ADCMODE : byte; absolute 0xD1; volatile; sfr;
ADC0CON1 : byte; absolute 0xD2; volatile; sfr;
ADC1CON : byte; absolute 0xD3; volatile; sfr;
SF : byte; absolute 0xD4; volatile; sfr;
ICON : byte; absolute 0xD5; volatile; sfr;
PLLCON : byte; absolute 0xD7; volatile; sfr;
ADCSTAT : byte; absolute 0xD8; volatile; sfr; bdata ;
ADC0L : byte; absolute 0xD9; volatile; sfr;
ADC0M : byte; absolute 0xDA; volatile; sfr;
ADC0H : byte; absolute 0xDB; volatile; sfr;
ADC1M : byte; absolute 0xDC; volatile; sfr;
ADC1H : byte; absolute 0xDD; volatile; sfr;
ADC1L : byte; absolute 0xDE; volatile; sfr;
PSMCON : byte; absolute 0xDF; volatile; sfr;
ACC : byte; absolute 0xE0; volatile; sfr; bdata ;
OF0L : byte; absolute 0xE1; volatile; sfr;
OF0M : byte; absolute 0xE2; volatile; sfr;
OF0H : byte; absolute 0xE3; volatile; sfr;
OF1L : byte; absolute 0xE4; volatile; sfr;
OF1H : byte; absolute 0xE5; volatile; sfr;
ADC0CON2 : byte; absolute 0xE6; volatile; sfr;
I2CCON : byte; absolute 0xE8; volatile; sfr; bdata ;
GN0L : byte; absolute 0xE9; volatile; sfr;
GN0M : byte; absolute 0xEA; volatile; sfr;
GN0H : byte; absolute 0xEB; volatile; sfr;
GN1L : byte; absolute 0xEC; volatile; sfr;
GN1H : byte; absolute 0xED; volatile; sfr;
B : byte; absolute 0xF0; volatile; sfr; bdata ;
I2CADD1 : byte; absolute 0xF2; volatile; sfr;
SPIDAT : byte; absolute 0xF7; volatile; sfr;
SPICON : byte; absolute 0xF8; volatile; sfr; bdata ;
DACL : byte; absolute 0xFB; volatile; sfr;
DACH : byte; absolute 0xFC; volatile; sfr;
DACCON : byte; absolute 0xFD; volatile; sfr;

matrix
Posts: 203
Joined: 26 Jan 2006 07:21
Location: Bulgaria
Contact:

Re: ADUC 845 support

#5 Post by matrix » 05 Apr 2011 14:51

Do you know memory map of controller, and how many clocks per instruction are used?

veerabahu
Posts: 4
Joined: 15 Mar 2011 13:21

Re: ADUC 845 support

#6 Post by veerabahu » 24 Apr 2011 08:37

Thank you matrix . Yes I know the memory map .

It uses one clock per instruction .

Post Reply

Return to “mikroPascal PRO for 8051 General”