Skip to main content
Visitor II
July 31, 2003
Question

inDart problem

  • July 31, 2003
  • 3 replies
  • 723 views
Posted on July 31, 2003 at 03:41

inDart problem

    This topic has been closed for replies.

    3 replies

    pichetAuthor
    Visitor II
    July 28, 2003
    Posted on July 28, 2003 at 06:11

    My customer face some problem with ST7 instruction while using inDart ST7FLite0. Please find below.

    LD   A, #$10         ; N flag = 0. This is correct.

    LD   A, #$90         ; N = 1 ????   Why??    90h is not negative value.

    LD   A, #$0A0       ; load A0h into Accumulator A.

    CP   A, #$30         ; N = 0. This is correct because A0h > 30h

    CP   A, #$10         ; N = 1????   Why??   (A0h - 10h) > 0

    And sub instruction show the same result as CP.

    And other question is about to start-up the FLITE09. For example, we connect LED to some I/O but every time when we power the application up by plug-in the supply voltage, the LED 1 time blink shortly and randomly.  How could we eliminate this?  Imagine as you connect the I/O with other peripheral and you need to check EMC testing.  This blink MUST not occur.

    Cust also tried to config the I/O as push-pull and open-drain but it still blink. HELP!!

    Best regards,

    JOM

    Visitor II
    July 28, 2003
    Posted on July 28, 2003 at 07:35

    What you are seeing is correct.

    On datasheet you can find about the N flag:

    ''This bit is set and cleared by hardware. It is representative of the result sign of the last arithmetic, logical or data manipulation. It’s a copy of the result 7th bit.

    0: The result of the last operation is positive or null.

    1: The result of the last operation is negative

    (i.e. the most significant bit is a logic 1).

    Concerning the blinking LED, please set the DDR register as output before the initialization.

    [ This message was edited by: friul on 28-07-2003 11:10 ]
    Visitor II
    July 31, 2003
    Posted on July 31, 2003 at 03:41

    In the first case i.e.

    LD A, #$0A0 ; load A0h into Accumulator A.

    CP A, #$30

    Here the result of subtraction of 0xA0 and 0x30 is 0x70 (0111 0000)

    bit 7 of the result is 0 so N flag is 0.

    In second case, the result of subtraction is (1001 0000) so the N flag is set to 1.