BasicMicro - Forums

www.basicmicro.com
It is currently Mon May 21, 2012 1:11 am

All times are UTC - 8 hours [ DST ]




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: Can't access ports
PostPosted: Wed May 21, 2003 10:00 am 
I don't seem to be able to access port registers using PEEK/POKE. I wrote a test program to read all registers in the range 0xff80 to 0xffff, which includes PC8 (0xffeb) and PD8 (0xffdb). Port 8, pin 7 of the H8/3664 is P15 on the Atom Pro X. I can switch on and off an LED connected to P15 by hitting the "1" and "2" keys on my keyboard, but the displayed contents of PD8, as well as every other register in the range 0xff80 to 0xffff, is always 0xff.

Reg var Byte
DReg var Word

Main:
Serout S_OUT, I9600, ["Go:"]
For DReg = 0xff80 to 0xffff
Peek Dreg, Reg
Serout S_OUT, I9600, [hex Reg]
Serout S_OUT, I9600, [","]
Next
Serout S_OUT, I9600, [13]
Serin S_IN, I9600, [Reg]
If Reg = "1" Then Gosub Lite
If Reg = "2" Then Gosub Dark
Goto Main

Lite:
LOW 15
Return

Dark:
HIGH 15
Return



Top
  
 
 Post subject: Re: Can't access ports
PostPosted: Fri May 23, 2003 10:00 am 
I haven't received a response from support or this forum about how to get direct access to I/O registers, so I explored another approach: assembler code. But the ASM { ... } syntax does not seem to work in the PRO version of the IDE.


Top
  
 
 Post subject: Re: Can't access ports
PostPosted: Fri May 23, 2003 10:00 am 
Offline
Citizen

Joined: Sat Mar 08, 2003 11:00 am
Posts: 40
Yes, I believe the 'ASM' construct only works on MBasic Pro, which is their compiler. They may get it working on the Atom Pro module, although the Atom module does not support it.


Top
 Profile  
 
 Post subject: Re: Can't access ports
PostPosted: Mon May 26, 2003 10:00 am 
Offline
Site Admin
User avatar

Joined: Thu Mar 01, 2001 11:00 am
Posts: 903
Location: Temecula, CA
You can directly access port/pin/direction registers using the DIR/IN and OUT variables(7.1.0.2+). The PEEK/POKE commands only access memory locations F780 through FFFF and(heres the key) PEEK and POKE are indexed at 0. So PEEK 0,variable would grab the value at F780 and store it in variable.

Nathan


_________________
Tech Support
Basic Micro - Robotic Technology Evolved


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC - 8 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group

phpBB SEO