Forum - MCS Electronics

 

FAQFAQ SearchSearch RegisterRegister Log inLog in

BASCOM 8051 compatibility

 
Post new topic   Reply to topic    www.mcselec.com Forum Index -> BASCOM-8051
View previous topic :: View next topic  
Author Message
andyf97

Bascom Member



Joined: 20 Oct 2011
Posts: 67

romania.gif
PostPosted: Mon May 27, 2013 7:42 pm    Post subject: BASCOM 8051 compatibility Reply with quote

So I am just starting to work on something new that requires a Silabs C8051F930

http://www.silabs.com/products/mcu/lowpower/Pages/C8051F92x-93x.aspx

I love Bascom AVR and use it now for pretty much all of my projects

I have a new project that MUST be run on an C8051F930 which according to Silabs is 100% 8051 compatible and I would love to do this with the 8051 version of Bascom.

I could just throw some Hex at it to see what happens but thought to ask here if anyone has some pointers to doing it right and I do also do need to buy Bascom 8051.

The project I am working on is quite simple to create in bascom AVR with just a few lines of code that takes some serial data from one source and re-sends it to another with some additional bits added so I cannot imagine it being any more complex in Bascom 8051.

Of course I have no clue where to start Smile

Andy
Back to top
View user's profile
albertsm

Administrator



Joined: 09 Apr 2004
Posts: 5922
Location: Holland

blank.gif
PostPosted: Tue May 28, 2013 1:02 pm    Post subject: Reply with quote

8051F410.dat and 8051F911.DAT were the last added silab files.
there is also the 8051F300.dat but no file for F930.
but these files are simple to add. just use a file that is almost identical and add/change the registers with their address.
the object code should work.

_________________
Mark
Back to top
View user's profile Visit poster's website
andyf97

Bascom Member



Joined: 20 Oct 2011
Posts: 67

romania.gif
PostPosted: Tue May 28, 2013 8:04 pm    Post subject: Reply with quote

Hello Mark Alberts and thank you for your reply

I assume all the required data comes from the header/inc files used in the silabs IDE;

I am looking now in C8051F390.inc and C8051F390_defs.h which are full of data.

There seams to be far more registers on the silabs files than there are in a 8051F300.DAT and I am also a bit lost on how the data should be taken as the format is slightly different.

I wonder if somebody could create the DAT file for me to be the best possible perfect file, I could upload the C8051F390.inc and C8051F390_defs.h here or send them by email, they have copyright messages in so I am not sure if it ok to upload them onto a public forum even tho they come free with the IDE.

Examples

From the 8051F300.DAT are
Code:


[BIT]
CPT0CN = F8 , 00
B = F0 , 00
ADC0CN = E8 , 00
ACC = E0 , 00
PCA0CN = D8 , 00
PSW = D0 , 00
TMR2CN = C8 , 00
SMB0CN = C0 , 00
IP = B8 , C0
IE = A8 , 00
SCON = 98 , 00
TCON = 88 , 00
P0 = 80 , FF
 



From the C8051F390_defs.h are:

Code:
 
P0       0x80
TCON     0x88
P1       0x90
SCON0    0x98
P2       0xA0
IE       0xA8
IP       0xB8
SMB0CN   0xC0
SMB1CN   0xC0
TMR2CN   0xC8
TMR5CN   0xC8
PSW      0xD0
PCA0CN   0xD8
ACC      0xE0
ADC0CN   0xE8
B        0xF0
SPI0CN   0xF8

 
Back to top
View user's profile
andyf97

Bascom Member



Joined: 20 Oct 2011
Posts: 67

romania.gif
PostPosted: Tue May 28, 2013 9:56 pm    Post subject: Reply with quote

So I studded other DAT files and compared how data was being listed then did the same from the Silabs data, not sure if I have done it right tho so maybe its not such a good idea to use this, maybe somebody could confirm it.

I also have extracted all the data from the .H files into a spreadsheet and formatted all the values into columns if it need doing another way.

Soon as this is confirmed I am going to order 8051 Bascom.

Code:



[BYTE]
P0          =  80,0
SP          =  81,0
DPL         =  82,0
DPH         =  83,0
P4          =  84,0
P5          =  85,0
P6          =  86,0
PCON        =  87,0
TCON        =  88,0
TMOD        =  89,0
TL0         =  8A,0
TL1         =  8B,0
TH0         =  8C,0
TH1         =  8D,0
CKCON       =  8E,0
PSCTL       =  8F,0
P1          =  90,0
TMR3CN      =  91,0
TMR3RLL     =  92,0
TMR3RLH     =  93,0
TMR3L       =  94,0
TMR3H       =  95,0
P7          =  96,0
SCON0       =  98,0
SBUF0       =  99,0
SPI0CFG     =  9A,0
SPI0DAT     =  9B,0
ADC1        =  9C,0
SPI0CKR     =  9D,0
CPT0CN      =  9E,0
CPT1CN      =  9F,0
P2          =  A0,0
EMI0TC      =  A1,0
EMI0CF      =  A3,0
P0MDOUT     =  A4,0
P1MDOUT     =  A5,0
P2MDOUT     =  A6,0
P3MDOUT     =  A7,0
IE          =  A8,0
SADDR0      =  A9,0
ADC1CN      =  AA,0
ADC1CF      =  AB,0
AMX1SL      =  AC,0
P3IF        =  AD,0
SADEN1      =  AE,0
EMI0CN      =  AF,0
P3          =  B0,0
OSCXCN      =  B1,0
OSCICN      =  B2,0
P74OUT      =  B5,0
FLSCL       =  B6,0
FLACL       =  B7,0
IP          =  B8,0
SADEN0      =  B9,0
AMX0CF      =  BA,0
AMX0SL      =  BB,0
ADC0CF      =  BC,0
P1MDIN      =  BD,0
ADC0L       =  BE,0
ADC0H       =  BF,0
SMB0CN      =  C0,0
SMB0STA     =  C1,0
SMB0DAT     =  C2,0
SMB0ADR     =  C3,0
ADC0GTL     =  C4,0
ADC0GTH     =  C5,0
ADC0LTL     =  C6,0
ADC0LTH     =  C7,0
T2CON       =  C8,0
T4CON       =  C9,0
RCAP2L      =  CA,0
RCAP2H      =  CB,0
TL2         =  CC,0
TH2         =  CD,0
SMB0CR      =  CF,0
PSW         =  D0,0
REF0CN      =  D1,0
DAC0L       =  D2,0
DAC0H       =  D3,0
DAC0CN      =  D4,0
DAC1L       =  D5,0
DAC1H       =  D6,0
DAC1CN      =  D7,0
PCA0CN      =  D8,0
PCA0MD      =  D9,0
PCA0CPM0    =  DA,0
PCA0CPM1    =  DB,0
PCA0CPM2    =  DC,0
PCA0CPM3    =  DD,0
PCA0CPM4    =  DE,0
ACC         =  E0,0
XBR0        =  E1,0
XBR1        =  E2,0
XBR2        =  E3,0
RCAP4L      =  E4,0
RCAP4H      =  E5,0
EIE1        =  E6,0
EIE2        =  E7,0
ADC0CN      =  E8,0
PCA0L       =  E9,0
PCA0CPL0    =  EA,0
PCA0CPL1    =  EB,0
PCA0CPL2    =  EC,0
PCA0CPL3    =  ED,0
PCA0CPL4    =  EE,0
RSTSRC      =  EF,0
B           =  F0,0
SCON1       =  F1,0
SBUF1       =  F2,0
SADDR1      =  F3,0
TL4         =  F4,0
TH4         =  F5,0
EIP1        =  F6,0
EIP2        =  F7,0
SPI0CN      =  F8,0
PCA0H       =  F9,0
PCA0CPH0    =  FA,0
PCA0CPH1    =  FB,0
PCA0CPH2    =  FC,0
PCA0CPH3    =  FD,0
PCA0CPH4    =  FE,0
WDTCN       =  FF,0

[BIT]
P0          =  80,0
TCON        =  88,0
P1          =  90,0
SCON0       =  98,0
P2          =  A0,0
IE          =  A8,0
P3          =  B0,0
IP          =  B8,0
SMB0CN      =  C0,0
T2CON       =  C8,0
PSW         =  D0,0
PCA0CN      =  D8,0
ACC         =  E0,0
ADC0CN      =  E8,0
B           =  F0,0
SPI0CN      =  F8,0


[WORD]
DP          =  82,0
TMR3RL      =  92,0
TMR3        =  94,0
ADC0        =  BE,0
ADC0GT      =  C4,0
ADC0LT      =  C6,0
RCAP2       =  CA,0
T2          =  CC,0
TMR2RL      =  CA,0
TMR2        =  CC,0
RCAP4       =  E4,0
T4          =  F4,0
TMR4RL      =  E4,0
TMR4        =  F4,0
DAC0        =  D2,0
DAC1        =  D5,0

[MISC]
up          =  C8051F930


 




There are also a lot of these and I wonder if they should also be added.



Code:



//-----------------------------------------------------------------------------
// Bit Definitions
//-----------------------------------------------------------------------------
// TCON 0x88
SBIT (TF1, SFR_TCON, 7);               // Timer 1 Overflow Flag


//-----------------------------------------------------------------------------
// Interrupt Priorities
//-----------------------------------------------------------------------------
#define INTERRUPT_INT0           0     // External Interrupt 0


//-----------------------------------------------------------------------------
// SDCC PDATA External Memory Paging Support
//-----------------------------------------------------------------------------





 
Back to top
View user's profile
albertsm

Administrator



Joined: 09 Apr 2004
Posts: 5922
Location: Holland

blank.gif
PostPosted: Tue May 28, 2013 10:05 pm    Post subject: Reply with quote

it appears to be OK. but : you must remove the duplicates. if a register is under the BIT section ( address ends with 0 or 8 ) it may not be listed under the BYTE section.
the value after the comma is the default register value and is only used by the simulator.

_________________
Mark


Last edited by albertsm on Tue May 28, 2013 10:29 pm; edited 1 time in total
Back to top
View user's profile Visit poster's website
andyf97

Bascom Member



Joined: 20 Oct 2011
Posts: 67

romania.gif
PostPosted: Tue May 28, 2013 10:22 pm    Post subject: Reply with quote

Quote:

you must remove the duplicates.

if a register is under the BIT section (address ends with 0 or a yellow face it may not be listed under the BYTE section.

The value after the comma is the default register value and is only used by the simulator.



What character was the yellow face ?

So then, a first example is The P0 in the BYTE List would need to be removed.

Is it possible to add remarks on the end of each line with the usual rem character?

And also is it possible to remark out lines.
Back to top
View user's profile
albertsm

Administrator



Joined: 09 Apr 2004
Posts: 5922
Location: Holland

blank.gif
PostPosted: Tue May 28, 2013 10:31 pm    Post subject: Reply with quote

the yellow face was caused by the ).
it was 8 (i changed it).

you can not add remarks.

_________________
Mark
Back to top
View user's profile Visit poster's website
andyf97

Bascom Member



Joined: 20 Oct 2011
Posts: 67

romania.gif
PostPosted: Wed May 29, 2013 9:35 pm    Post subject: Reply with quote

Hello Mark,

I sent you a support question about this KZS-66958-165, could you have a look at it please.
Back to top
View user's profile
bzijlstra

Bascom Ambassador



Joined: 30 Dec 2004
Posts: 1179
Location: Tilburg - Netherlands

netherlands.gif
PostPosted: Wed Jun 05, 2013 8:36 pm    Post subject: 8051F930 Reply with quote

Together with Andy we got it working.

With the attached DAT-file, and the two pictures from the datasheet.

Code:
$crystal = 24500000
$regfile = "8051F930.DAT"

OSCICN = OSCICN OR &H80 'Enable the precision internal osc.
RSTSRC = &H06 'Enable missing clock detector and leave VDD Monitor enabled.
CLKSEL = &H00 'Select precision internal osc & divided by 1 as the system clock


PCA0MD = &B00000000
P2MDOUT = &H00
XBR2 = &H40


do
WAITMS 200
P2 = &B11110100

WAITMS 200
P2 = &B11111111
loop



End
 


Last edited by bzijlstra on Sun Jun 16, 2013 9:27 am; edited 3 times in total
Back to top
View user's profile Visit poster's website
albertsm

Administrator



Joined: 09 Apr 2004
Posts: 5922
Location: Holland

blank.gif
PostPosted: Mon Jun 10, 2013 11:54 am    Post subject: Reply with quote

thanks Ben.

to make it complete(support additional interrupts) you need to make the MISC section like this :

[MISC]
up=C8051F930
I_TIMER2=2B
I_SPI0=33
I_SMB0=3B
I_RTC = 43
I_ADC0WC=4B
I_ADCEOC=53
I_PCA=5B
I_CMP0=63
I_CMP1=6B
I_T3OVFL = 73
I_VRGDRP=7B
I_PORTMTCH=83
I_SMRTCLFL=8B
I_SPI1=93
IRAM = 256
org = 96

_________________
Mark
Back to top
View user's profile Visit poster's website
bzijlstra

Bascom Ambassador



Joined: 30 Dec 2004
Posts: 1179
Location: Tilburg - Netherlands

netherlands.gif
PostPosted: Mon Jun 10, 2013 5:20 pm    Post subject: update DAT-file Reply with quote

Thanks. Will update the DAT-file and upload again.

DAT-file has been updated with a complete [MISC] part.

Having fun
Ben Zijlstra
Back to top
View user's profile Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    www.mcselec.com Forum Index -> BASCOM-8051 All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum