Discussion in "Project Doubts" started by    ranjan    Apr 5, 2007.
Thu Apr 05 2007, 08:55 pm
#1
HEY RICKEY
i sent an e-mail with the code in assembly.did you find any errors?...i have compiled it using ride and corrected a few like changing acall with lcall.anything wrong with logic?
Fri Apr 06 2007, 01:50 pm
#2
I checked your code, the displaying status is a little big.
make it small i give you example....

stat:mov p2,#0ffh                  ;reading port status
         mov a,p2
          rrc a                    ;if carry then led is on 
         jnc led_0
         mov dptr,#msg_2         ;else display led is off
 again_2:clr a
         movc a,@a+dptr
         jz led_11                 ;once finished jmp to next led
          acall t_pc              ;routine for display    
         inc dptr
         sjmp again_2
   led_0:mov dptr,#msg_3         ;display led is on
 again_3:clr a
         movc a,@a+dptr
         jz led_11
         acall t_pc
         inc dptr
         sjmp again_3



Instead of above you can do like this...
stat:                    ;if carry then led is on 
         jnc P2.0,led_0
         mov dptr,#msg_2         ;else display led is off
 again_2:clr a
         movc a,@a+dptr
         jz led_11                 ;once finished jmp to next led
          acall t_pc              ;routine for display    
         inc dptr
         sjmp again_2
   led_0:mov dptr,#msg_3         ;display led is on
 again_3:clr a
         movc a,@a+dptr
         jz led_11
         acall t_pc
         inc dptr
         sjmp again_3


So you need not to move 0xFF all the time, when reading.
And instead of toggling the LEDs, add some more code and ask for on or off.. will be more nice..
Code seems to be ok! did u test it?
Fri Apr 06 2007, 09:19 pm
#3
hey rickey
thanks for checking my code.i have not been able to test it as i have trouble transmitting char. using windows hyperterminal.it does not show what i type.can u suggest any method 4 serial data transmission in windows.
i need to see the status too on my pc.
Fri Apr 06 2007, 11:25 pm
#4
Well you need to activate the option of echo typed characters. Or i have uploaded a small serial communication software. which you can download from the download area in other useful softwares. hope this will help you.

Get Social

Information

Powered by e107 Forum System

Downloads

Comments

IrardlPex
Wed Apr 24 2024, 08:42 pm
Charlestehed
Wed Apr 24 2024, 05:20 pm
Robertgurse
Wed Apr 24 2024, 02:43 pm
Richardedils
Wed Apr 24 2024, 04:07 am
ChrisLub
Tue Apr 23 2024, 05:21 pm
Davidbab
Tue Apr 23 2024, 10:41 am
Richardrit
Tue Apr 23 2024, 09:54 am
HenryLaf
Mon Apr 22 2024, 03:50 pm