BasicMicro - Forums

www.basicmicro.com
It is currently Sun May 20, 2012 11:38 pm

All times are UTC - 8 hours [ DST ]




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: SIN/SOUT maps to $02F ?
PostPosted: Tue Sep 22, 2009 5:44 pm 
Basic Atom pins. Porting over to MBasic 5.2.1.1 old IDE.

SIN/SOUT appears to map to $02F (Basic Atom .ASM file), although this is past the range of PIC pins, isn't it?

A0-A5 = 0-5
B0 -B7 = 8-15
C0-C7 = 16-23
D0-D7 = 24-31

And we don't have registers D & E anyway on an '876.


Top
  
 
 Post subject: Re: SIN/SOUT maps to $02F ?
PostPosted: Tue Sep 22, 2009 11:05 pm 
Offline
Master

Joined: Sun Aug 17, 2008 5:26 pm
Posts: 798
Location: CA bay Area
Hi. I'm confused. There is no s_out/s_in for Pro5211. 0 to 7 is B0 to B7, 8 to 15 is C0 to C7. You can refer to any pin by its port number: A0, D7, B2, C6, whatever. If you write:
serout s_out, i9600, ["Hello?World?"]
the compiler will hurl. Well, actually, it will report an "unexpected token type". Pick a pin, like A0, for serial work and write:
serout (or serin) A0, i9600, ["Hell o'world!"]
and A0 is a serial pin. Careful with A4 (or is it A5?), the pin typically used on Atoms, as it is an open-collector port and needs a pullup.

What are you trying to do here?

_________________
kenjj
http://blog.basicmicro.com/
http://kjennejohn.wordpress.com/


Top
 Profile  
 
 Post subject: Re: SIN/SOUT maps to $02F ?
PostPosted: Wed Sep 23, 2009 6:32 am 
Offline
Master

Joined: Tue Nov 21, 2006 9:34 am
Posts: 527
Hi Alan,

I am not 100% sure about the Atoms as I mainly use the Pros...

However I am guessing that the code is semi-similar and I believe S_IN and S_OUT on the Pros map to the same place. So I will explain it as I know it on the pro...

When you use a pin number to some function such as Serin, there is a lookup table that will convert the logical pin number into the port address and the pin number on the port. The table also includes space to convert S_IN and S_OUT. In fact yesterday I posted a function on the Lynxmotion forum: http://www.lynxmotion.net/viewtopic.php?p=55281#55281 that provided an assembly language function for Xan that would give you the current input value for a pin that is passed to it as a variable.

Kurt


Top
 Profile  
 
 Post subject: Re: SIN/SOUT maps to $02F ?
PostPosted: Wed Sep 23, 2009 10:51 am 
Ken,

Sorry if I was confusing! Did I mention I was talking about the AtomBasic chip (not PRO), and the MBasic compiler?

s_out/s_in is equated to $02F & $02E in the ASM generated by the AtomBasic compiler.

When I attempted to compile the same program in MBasic, it didn't have a define for S_OUT, so I referred to the ASM file to determine it.

I believe the following are correct for MBasic (it's out of the manual)?

A0-A5 = 0-5
B0 -B7 = 8-15
C0-C7 = 16-23
D0-D7 = 24-31

and B0 being equ 8 fits that table.

S_OUT/S_IN are connected to RA4 according to the schematic of the BasicAtom (not pro) chip. Which is not one of the P0-P18 pins. I would have expected it (both) to be equ to 4.

I know "serout (or serin) A0, i9600, ["Hell o'world!"]" won't compile ;>)

OK, so I'll just map to a more appropriate pin. I probably want to go HSEROUT/HSERIN anyway (hardware).

MBasic doesn't assume (does it work) the AtomBasic modules, so I suppose the question is moot anyway.

I have (BasicMicro) 'bot code that I'd like to run on 18F452 and 18F4620 chips (I have several development boards), if MBasic gets there. Some stuff would be OK on an '877, which would be a start.

Kurt,

I'm not not talking about the Pro, but I did like the function you posted yesterday. I haven't wanted to delve into ASM for the Pro yet.

So many "similar" modules and compilers!

Thanks!

Alan KM6VV
------------------------------------------------------------
kenjj wrote:
Hi. I'm confused. There is no s_out/s_in for Pro5211. 0 to 7 is B0 to B7, 8 to 15 is C0 to C7. You can refer to any pin by its port number: A0, D7, B2, C6, whatever. If you write:
serout s_out, i9600, ["Hello?World?"]
the compiler will hurl. Well, actually, it will report an "unexpected token type". Pick a pin, like A0, for serial work and write:
serout (or serin) A0, i9600, ["Hell o'world!"]
and A0 is a serial pin. Careful with A4 (or is it A5?), the pin typically used on Atoms, as it is an open-collector port and needs a pullup.

What are you trying to do here?


Top
  
 
 Post subject: Re: SIN/SOUT maps to $02F ?
PostPosted: Fri Sep 25, 2009 12:09 pm 
Never mind.


Top
  
 
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