Forum Index
HomeZBasic Home   Forum RulesForum Rules   Forum FAQForum FAQ   MemberlistMemberlist   UsergroupsUsergroups   RSS FeedRSS Feed
Site SearchSite Search   LinksLinks   DownloadDownload   Digests and SubscriptionsDigests and Subscriptions
ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in   RegisterRegister
Suggested Enhancement for Logical Pin Numbers

 
Post new topic   Reply to topic    Forum Index -> ZBasic Language
Author Message
mikep



Joined: 24 Sep 2005
Posts: 765
Location: Austin, TX

Posted: 27 December 2005, 4:37 AM    Post subject: Suggested Enhancement for Logical Pin Numbers Reply with quote

The only real difference between the various flavors of ZX chip is the physical pin numbers which are mapped to the actual ATmega32 pin numbers inside the ZBasic virtual machine. The TargetCPU option is a directive to the compiler which results in mapping explicit pin designations such as A.6 to the physical pin number.

However one requirement is to have the same ZBasic program whatever the ZX chip being used. This allows people to distribute their programs in compiled form without needing to worry about which ZX chip it will be run on (except in the case where function is used that is not available on the ZX-24 because of the more limited physical pinout).

Enter the idea of logical pin designations where the compiler uses the TargetCPU option to map physical pin numbers to logical ones. For example C.6 could be mapped to 150 (128+8+8+6). The compiler when compiling for a ZX-24 (the default) can convert pin 19 to A.1 and therefore to logical pin 129 (128+1). If using the Option TargetCPU ZX40 then pin 19 is converted to D.5 (logical pin 157). If using Option TargetCPU ZX44 then pin 19 is converted to C.0 (logical pin 146).

Both the compiler and internal VM for each chip need to be changed. The reason for setting the MSB of the logical pin number (128) is so that programs compiled with previous versions of the compiler still run. The VM can easily use a different mapping table for the logical pins 128 to 159.
Back to top
dkinzer
Site Admin


Joined: 03 Sep 2005
Posts: 2499
Location: Portland, OR

Posted: 27 December 2005, 17:00 PM    Post subject: Reply with quote

This change is on the list of things to do. The plan is to use the MSB to indicate that the remaining 7 bits specify a port/pin combination. Three bits are needed to specify a bit number and the other 4 bits specify the port (A=0, etc.).
Back to top
mikep



Joined: 24 Sep 2005
Posts: 765
Location: Austin, TX

Posted: 27 December 2005, 18:47 PM    Post subject: Reply with quote

The change for logical pin numbering becomes obvious once you add more chips to the mix such as ZX-44. I'm glad to see you already thought of this Smile
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Forum Index -> ZBasic Language Time synchro. with the server - Timezone/DST with your computer
Page 1 of 1

 


All content Copyright © 2005-2012 Elba Corp. All Rights Reserved.
Opinions expressed in posts are those of the author and not necessarily those of Elba Corp.
Powered by phpBB © 2001, 2005 phpBB Group