Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
10/20/10 14:30
Read: times


 
#179207 - 1) formatted, 2)commented, 3) correct
Responding to: ???'s previous message
/* 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 LEDs
      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.

; 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 file is



:020000000130CD
:1000300075A5FFA20092A3B3920092A411400133D0
:100040007FFA7E3D0000000000000000DEF6DFF2D7
:10005000222843292044494749504F5745522032CE
:0D006000303130204C5043393336413120CF
:00000001FF
 



List of 49 messages in thread
TopicAuthorDate
p89lpc936 keil programming help required.            01/01/70 00:00      
   magic code?            01/01/70 00:00      
      mov 0A5H,#0FFH            01/01/70 00:00      
   a glaring difference            01/01/70 00:00      
      a glaring difference            01/01/70 00:00      
         what happens if            01/01/70 00:00      
            what happens if            01/01/70 00:00      
               BiDir or PushPull            01/01/70 00:00      
               I leave it to you            01/01/70 00:00      
                  magic code?            01/01/70 00:00      
                  I leave it to you            01/01/70 00:00      
                     1) formatted, 2)commented, 3) correct            01/01/70 00:00      
                        1) formatted, 2)commented, 3) correct            01/01/70 00:00      
                           it is STILL two different things            01/01/70 00:00      
                              Apples and Orange Juice            01/01/70 00:00      
                                 Please focus on the problem i have            01/01/70 00:00      
                                    Software delay loop in C is a no-no            01/01/70 00:00      
                                       Software delay loop in C is a no-no            01/01/70 00:00      
                                          Reduce problem into smaller problems            01/01/70 00:00      
                                             Reduce problem into smaller problems            01/01/70 00:00      
                                             Simulator vs real hardware            01/01/70 00:00      
                                             Current limits            01/01/70 00:00      
                                             Per Westermark's previous message            01/01/70 00:00      
                                                Delay speed            01/01/70 00:00      
                                                   Elaborate            01/01/70 00:00      
                                                      tried 5 for the '51 and Keil won            01/01/70 00:00      
                                    the problem you have is ...            01/01/70 00:00      
                                       the problem you have is ...            01/01/70 00:00      
                                          do you have LEDs connected to the simulator?            01/01/70 00:00      
                                          not executing on actual hardware while simulator is fine            01/01/70 00:00      
                                    Oh So Focused            01/01/70 00:00      
   Double-post            01/01/70 00:00      
   Are you using the limited version of KEIL? the for loop....            01/01/70 00:00      
      valid C            01/01/70 00:00      
         Thats the point            01/01/70 00:00      
            nope            01/01/70 00:00      
               I wouldnt trust it            01/01/70 00:00      
                  if you do not trust it ....            01/01/70 00:00      
               And if you trust it so much why doesnt it work?            01/01/70 00:00      
                  And if you trust it so much why doesnt it work?            01/01/70 00:00      
                     trust, yes, but knowledge also required            01/01/70 00:00      
                  wait call + assumptions about two-complement, ...            01/01/70 00:00      
                     The C Standard            01/01/70 00:00      
                        who is "you"?            01/01/70 00:00      
            Yes, you can!            01/01/70 00:00      
      Quite common loop design for bit operations            01/01/70 00:00      
      for( expression-1; expression-2; expression-3 ) [ed]            01/01/70 00:00      
         erratum            01/01/70 00:00      
            Corrigendum            01/01/70 00:00      

Back to Subject List