I don't mean to sound nasty, but you can't expect others here to do your work for you. We can offer tips and a bit of help, but this is a fair bit of work.
This would make a great exercise for learning Bascom (unless you already know Basic/Bascom and need help with C, in which case this maybe isn't the best forum) - try starting with getting the LCD to display simple text, then develop the code to control the ADC and finally the temperature conversion. _________________ If all else fails, read the manual. Even better: read the manual before something fails. If you can't find it in the manual, search the forum.
BascomAVR 2.0.8.5
Posted: Sat May 10, 2008 8:26 am Post subject: Re: Anyone can make .bas from .c file?
ddgsmdd wrote:
I need help with converting .c source file for AT89S52 to BASCOM-8051;
Anyone can help;
Source in c and scheme is attached;
Regards,
ddgsm.
Code:
'--------------------------------------------------------------------- ' LTC1298.BAS ' (c) 1995-2006 MCS Electronics 'This example shows how to make use of ASM libs '--------------------------------------------------------------------- 'First we tell the compiler about the lib $lib"Ltc1298.lib"
'Second we tell which subroutine must be included from that lib $external _ltc1298
'[ALIAS] 'It is a good idea to alias the used pins and to precede the clock and 'other pins with the chipname
Ltc1298_cs Alias P1.4
Ltc1298_clock Alias P1.3
Ltc1298_din Alias P1.2
'Now declare the subroutine DeclareSub Ltc1298(w AsWord)
'We pass a word to this routine Dim W AsWord
'call the sub routine with variable W
Ltc1298 W
Print W
End
'here we create the SUB 'this would normally not be needed but it is the only way to pass the address 'of the variable to the sub routine. This will be changed in the future and then 'you could ommit this code! So it is a good idea to store it into an include file 'when you have a buncg of them Sub Ltc1298(w AsWord) $asm ' We put the address of the MSB into register r0
mov r0,#{w+1}; address of MSB W into r0
'now call the actually routine in the lib
lcall _ltc1298
'the lib routine handles the rest $endAsm EndSub
I think its enough to getting start with . Try to search .
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