Searching \ for '[SX]:IREAD instruction' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/ubicom/devices.htm?key=sx
Search entire site for: 'IREAD instruction'.

Exact match. Not showing close matches.
PICList Thread
'[SX]:IREAD instruction'
2002\05\28@041402 by ISO-8859-1?Q?Ruben_J=F6nsson?=

flavicon
face
Hello,


> What is the date code on the SX52? Some older versions are not
> supported with the SX-Key Rev E.
> http://www.sxlist.com/techref/ubicom/sx48-52.htm

The datecode is AB0022AT so it should be ok, i guess.

> Is the failure reliable? If not, it may be a communications
> failure between the SX-Key and the PC or excessive noise or bad
> connection between the key and 52. I've seen a lot of "strange"
> things with SX-Keys.

The failure is reliable but it doesn't seem to give exactly the same
results when single stepping, running with the debugger or running without
the debugger.

Here is a program that does fail, both single stepped with the debugger and
run without the debugger. When run with the debugger it reports 'Sleeping'
and doesn't lit either the red or green led, though:

       DEVICE  OSCXT2,BOR42,DRT18MS

       FREQ    10_000_000
       RESET   Startup

       r_LED_GREEN     equ     re
       b_LED_GREEN     equ     0
       f_LED_GREEN     equ     r_LED_GREEN.b_LED_GREEN
       m_LED_GREEN     equ     1<<b_LED_GREEN

       r_LED_RED       equ     re
       b_LED_RED       equ     1
       f_LED_RED       equ     r_LED_RED.b_LED_RED
       m_LED_RED       equ     1<<b_LED_RED

       E_INPUTS        equ     ~(m_LED_RED | m_LED_GREEN)
       E_DEFAULT       equ     m_LED_RED | m_LED_GREEN

       org     $0a

       ROM_L           DS      1
       ROM_H           DS      1
       REF             DS      1

       org     0
_iread_
       jmp             @_iread_doit

Startup
string_test
       mov             w,#$1f
       mov             m,w
       mov             !re,#E_INPUTS
       mov             re,#E_DEFAULT

       mov             ROM_L,#(string & $ff)
       mov             ROM_H,#(string >> 8)
       mov             REF,#'A'
loop
       mov             w,ROM_H
       mov             m,w
       mov             w,ROM_L
       call            _iread_
       test            w
       snz
       jmp             success
       xor             w,REF
       sz
       jmp             fail
       inc             REF
       inc             ROM_L
       snz
       inc             ROM_H
       jmp             loop
fail
       clrb            f_LED_RED
       skip
success
       clrb            f_LED_GREEN
       jmp             $

       org     $300
_iread_doit
       iread
       retp

       org     $b00
string
       dw              'ABCDEFGHIJKLMNOPQRSTUVWXYZ',0

I have had a lot of other problems when doing the software for my current
project; Doing a retp without setting the page bits, reading from a
register to w but w isn't correct after the read, rtcc rollover interrupt
not triggered and now this. Some of these errors I have discovered without
the debugger and could verify with the debugger, some only seems to exist
with the debugger or act differently with the debugger. Most of the errors
have disappeared when moving the code around to other banks or just within
the same bank.

Is there something I can do to reduce the amount of 'strange' things with
the SX-Key, except replacing it?

The original program I posted did succeed without the debugger but the
program I have here more resembles my real program that does fail without
(and with) the debugger.

These 'strange' things are beginning to take up too much time from real
programming work and changing IDE might work to some extent but not
entirely since some errors still appear without the IDE.

{Quote hidden}

==============================
Ruben Jvnsson
AB Liros Electronic
Box 9124, 200 39 Malmv, Sweden
TEL INT +46 40142078
FAX INT +46 40947388
.....rubenKILLspamspam@spam@pp.sbbs.se
==============================

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics


2002\05\28@091717 by parkiss

picon face
Ruben-

Your IDE is probably just fine.  Take a closer look at the cross-page
calling techniques.  Try the following change for starters:

...
loop
        mov             w,ROM_H
        mov             m,w
        mov             w,ROM_L
        call            @_iread_     ; was _iread_
        test            w
...

A simple call to _iread_ does not push any page info, so the retp is
going to give unsatisfactory results.

Also note the m register gets clobbered is setting up the IREAD, so
you may not be accessing the port registers in the manner you intend
subsequently.  Be sure to reset m (MODE instruction or whatever)
as needed after an iread.


Regards,

Steve

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics


2002\05\28@131018 by ISO-8859-1?Q?Ruben_J=F6nsson?=

flavicon
face
Se inline comments


> Ruben-
>
> Your IDE is probably just fine.  Take a closer look at the cross-page
> calling techniques.  Try the following change for starters:
>
> ...
>  loop
>          mov             w,ROM_H
>          mov             m,w
>          mov             w,ROM_L
>          call            @_iread_     ; was _iread_
>          test            w
> ...
>
You better look again...

This will not work. My iread instruction is located at address $300 which can't be called to  (bit 8 is 1), which is why I have the jmp @_iread_ above the startup code. This is a common technique to call into the second half of a page. The jmp is mostly located at the same page as the destination, though, but that is not necessary (as here).

> A simple call to _iread_ does not push any page info, so the retp is
> going to give unsatisfactory results.

No again.

All calls push all 12 address bits (PC0:8 + PA0,PA1 and PA2), always (there is only one call actually call @... is two instructions). retp always sets the pagebits to the returned page, ret doesn't. You can always use retp regardless of how the call was made.
>
> Also note the m register gets clobbered is setting up the IREAD, so
> you may not be accessing the port registers in the manner you intend
> subsequently.  Be sure to reset m (MODE instruction or whatever) as
> needed after an iread.

No again.

The M register is only used when you set the port up (configure it for input/output/schmitt trigger/cmos/ttl/pullup...) not when you access the port bits themselves (as I do after the iread instruction).

So, have anybody tried my code and watched the results?

>
>
> Regards,
>
> Steve
>
Regards,

Ruben
==============================
Ruben Jönsson
AB Liros Elektronik
Box 9124, 200 39 Malmö, Sweden
TEL INT +46 40142078
FAX INT +46 40947388
rubenspamKILLspampp.sbbs.se
==============================

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics


More... (looser matching)
- Last day of these posts
- In 2002 , 2003 only
- Today
- New search...