Shop OBEX P1 Docs P2 Docs Learn Events
hmmm — Parallax Forums

hmmm

I'm having problems with both REP... and INA on both de2-115 and P123 A7. I have modified my code to output binary longs to Proptool's Terminal. In rep.jpg I am sending a patterned binary... in response to me typing an "i" into the terminal.

Notice that it repeats indefinitely... whereas in my code it should just output the number once.

In INA.jpg, I am trying to output the value of INA... and get all 1's, when some of them should be zeroes:)

In the what.jpg... I insert an arbitrary line after the end of the repeat loop... and then it only outputs two 1's each time I enter "i." even though it should repeat at least 30 times and give me something each time.

Normally, I am sending serial to a diy terminal and that is when I found the problem with INA... in trying to get something that could be used without my terminal, I generated this code and along the way found a problem with REP.

1185 x 572 - 260K
1055 x 564 - 269K
1096 x 632 - 78K

Comments

  • Rich
    You cannot use CALLs/JMPs in a REP loop
  • rjo__rjo__ Posts: 2,114
    now you tell me:)

    What's the deal with INA?

    I have no problem transmitting any other long:)
  • I checked out INA on my P123-A7 board.
    Here's the code used.
    'INA test P123-A7
    
    dat		orgh
    		org
    
    		setb	outb,#62
    		setb	dirb,#62
    
    again		mov	ax,ina 
    		cmp	bx,ax wz,wc
    	if_e	jmp	#again		'if change update value
    		mov	bx,ax
    
    		mov	cx,#32	'show binary value
    .loop		rcl	ax,#1 wc
    		mov	dx,#"0"
    	if_c	mov	dx,#"1"
    		call	#tx_byte
    		djnz	cx,#.loop
    
    		mov	dx,#13
    		call	#tx_byte
    		jmp	#again
    
    
    tx_byte		or	dx,#$100	'transmit byte
    		shl	dx,#1
    		getct	timer
    		rep	@.loop,#10
    		addct1	timer,bit_time
    		testb	dx,#0 wz
    		setbnz	outb,#62
    		waitct1
    		shr	dx,#1
    .loop
    		ret
    
    bit_time	long	50_000_000 / 115_200		
    		
    timer		res	1
    ax		res	1
    bx		res	1
    cx		res	1
    dx		res	1
    

    Pins were pulled down to GND via resistor and all pins checked out OK. :)
    I'm curious what results you get running the same code.

  • rjo__rjo__ Posts: 2,114
    of course it works:)

    I wasn't pulling anything low.

    wow
  • rjo__rjo__ Posts: 2,114
    Thank you
Sign In or Register to comment.