Hello all,
I am trying to program Blinky program from Keil complier to P89LPC936 microcontroller through a universal programmer(SuperPro). But the microcontroller is not running. But when i write a simple program in assambly and program the same hardware it works fine. Please I need help regarding it where i am doing wrong.
Here is code >>> Code: /* Blinky.C - LED Flasher for the Keil LPC900 EPM Emulator/Programmer Module */
#include <REG936.H> // register definition
void delay (unsigned long cnt) { while (--cnt); }
void main() { unsigned char i;
P1M1 |= 0x20; P1M2 &= 0xDF;
P2M1 &= 0xE7; P2M2 |= 0x18;
delay (20000); for(;;) { for (i = 0x01; i; i <<= 1) { P2 = i; // simulate running lights delay (20000); } for (i = 0x80; i; i >>= 1) { P2 = i; delay (20000); } } } Here is Hex file >>> :10006B008F0B8E0A8D098C08780874FF12004DECEB :06007B004D4E4F70F32210 :100003004391205392DF53A4E743A5187F207E4EEC :100013007D007C0012006B7B01EB6013F5A07F2059 :100023007E4E7D007C0012006BEB25E0FB80EA7BBB :1000330080EB60E3F5A07F207E4E7D007C00120004 :070043006BEBC313FB80EA25 :01004A002293 :04FFF00023001E00CC :08FFF800000000000000000001 :030000000200817A :0C00810078FFE4F6D8FD75810B02000347 :10004B007401FF3395E0FEFDFC080808E62FFFF670 :10005B0018E63EFEF618E63DFDF618E63CFCF622E9 :00000001FF
And here is the assembly code and its hex file which is working absolutely right.
Code: ; LPC936A1.A51 ; Oct 7, 2010 PCB: ?
; Features: ? ; ?
$mod51
RL1 bit P2.3 RL2 bit P2.4
DSEG AT 20H FLAG1: ds 1 STACK: ds 1
FRL1 bit FLAG1.0 ; Relay 1
CSEG org 0H ajmp Reset
org 30H Reset: mov 0A5H,#0FFH
Start: mov c,FRL1 ; mov RL1,c cpl c mov FRL1,c mov RL2,c
acall Delay0
ajmp Start
Delay0: mov R7,#250 Delay: mov R6,#61 Delay1: nop nop nop nop nop
nop nop nop djnz R6,Delay1 djnz R7,Delay ret
Text: DB '(C) DIGIPOWER 2010' Text0: DB ' LPC936A1 '
END
And its hex is :020000000130CD :1000300075A5FFA20092A3B3920092A411400133D0 :100040007FFA7E3D0000000000000000DEF6DFF2D7 :10005000222843292044494749504F5745522032CE :0D006000303130204C5043393336413120CF :00000001FF
Please help i m stuck.
Regards Dani
Besides forgetting to format your code using the proper tags, you also forgot to mention that you have also posted to: www.8052.com/.../179165
And you forgot to properly markup your code there too.
Sir,
That doesn't relay solves my problem. If you have any answer pertaining to my problem then please tell.
That doesn't relay solves my problem
it might
very few wants to decipher what is posted forgetting to format your code
Erik
#include <REG936.H> // Register definition
// Delay Function---------------------------- //------------------------------------------- void delay (unsigned long cnt) { while (--cnt); }
// Main Function---------------------------- //------------------------------------------- void main() {
unsigned char i;
delay (20000); for(;;) { for (i = 0x01; i; i <<= 1) { P2 = i; // simulate running lights delay (20000); } for (i = 0x80; i; i >>= 1) { P2 = i; delay (20000); } } } }// main()
-------------------------------------------------------------- Hex file..
:10006B008F0B8E0A8D098C08780874FF12004DECEB :06007B004D4E4F70F32210 :100003004391205392DF53A4E743A5187F207E4EEC :100013007D007C0012006B7B01EB6013F5A07F2059 :100023007E4E7D007C0012006BEB25E0FB80EA7BBB :1000330080EB60E3F5A07F207E4E7D007C00120004 :070043006BEBC313FB80EA25 :01004A002293 :04FFF00023001E00CC :08FFF800000000000000000001 :030000000200817A :0C00810078FFE4F6D8FD75810B02000347 :10004B007401FF3395E0FEFDFC080808E62FFFF670 :10005B0018E63EFEF618E63DFDF618E63CFCF622E9 :00000001FF
------------------------------------------------------------------
CSEG org 0H ;ajmp Reset
org 30H
Reset: mov 0A5H, #0FFH
Start: mov c, FRL1 ; mov RL1,c cpl c mov FRL1,c mov RL2,c
Delay0:mov R7, #250 Delay: mov R6, #61 Delay1:nop nop nop nop nop nop nop nop
djnz R6, Delay1 djnz R7,Delay ret
---------------------------------------------------------- And its hex is :020000000130CD :1000300075A5FFA20092A3B3920092A411400133D0 :100040007FFA7E3D0000000000000000DEF6DFF2D7 :10005000222843292044494749504F5745522032CE :0D006000303130204C5043393336413120CF :00000001FF
is it better now.. please help me.
is it better now.. please help me. No, READ THE TEXT ABOVE THE ENTRY WINDOW "place source code ..."
why have you not answered the questions posted at 8052.com
Erik,
I have tried it too, Even then it is not working. I think i m missing out some step while making the project and its settings which is not creating the hex file correctly. Any idea on this.
the start900.a51 i have left it to default is it right way to do this.
Regards
I will not continue discussing this in two places, look at 8052.com
I will not continue discussing this in two places, look at 8052.com Which was the reason I did cross-link the two threads. However, the OP didn't pick up on the meaning of cross-posting and the havoc and extra work introduced...