BasicMicroUK - Forums

www.basicmicro.co.uk
It is currently Sat Jan 20, 2018 7:58 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 20 posts ]  Go to page Previous  1, 2
Author Message
 Post subject: Re: Shiftin/Shiftout compatibility with BS2
PostPosted: Fri Apr 29, 2011 4:25 pm 
Offline
Master

Joined: Fri Nov 13, 2009 6:28 pm
Posts: 115
Location: Reno, Nevada
Shifting the line low and then high is important because the process is initiated when the shift to low is detected. I was using line 8 on the original posting and the timing is an issue unless you monitor the lines to determine when the process is complete. By inserting a 1 second delay you can ensure that the operation is complete before initiating another task. You must also take note of the shiftin/shiftout commands because they default to 16 bits instead of 8 as with the BS2. Below is an example of some code that works very well, but timing delays can be changed to suit your system requirements. The code below uses port 0 shifting low and then high to get ready for the next shift command and does an APC read.

APCREAD:
'POWER UP ISD
HIGH 0:PAUSE 2
LOW 0:PAUSE 2
SHIFTOUT MOSI,SCLK,LSBFIRST,[17\8,0\8]:HIGH 0:PAUSE 2
'RD_APC
LOW 0:PAUSE 2
SHIFTOUT MOSI,SCLK,LSBFIRST,[68\8,0\8,0\8,0\8]:HIGH 0:PAUSE 2
'DISPLAY MISO DATA FOR APC
LOW 0:PAUSE 2
SHIFTIN MISO,SCLK,LSBFIRST,[MISODAT1,MISODAT2,MISODAT3,MISODAT4]:HIGH 0:PAUSE 2

Thanks for the input.

_________________
Harley


Top
 Profile  
 
 Post subject: Re: Shiftin/Shiftout compatibility with BS2
PostPosted: Fri Apr 29, 2011 6:48 pm 
Offline
Site Admin
User avatar

Joined: Thu Mar 01, 2001 7:00 pm
Posts: 1316
Location: Temecula, CA
Hmm, what version of BasicMicro Studio are you using? I changed the shiftin/out commands to default to 8bits a long time ago.

_________________
Tech Support
Basic Micro - Robotic Technology Evolved


Top
 Profile  
 
 Post subject: Re: Shiftin/Shiftout compatibility with BS2
PostPosted: Sat Apr 30, 2011 4:55 am 
Offline
Master

Joined: Fri Nov 13, 2009 6:28 pm
Posts: 115
Location: Reno, Nevada
The code was developed quite awhile ago and I haven't revisited the issue since. Its good to know that it was changed and I think the code will be ok even though I specify 8 bits. Thanks and I will note the change. I am now using a much newer version. I haven't checked for the newest version for awhile and probably should do so.

_________________
Harley


Top
 Profile  
 
 Post subject: Re: Shiftin/Shiftout compatibility with BS2
PostPosted: Tue May 03, 2011 2:56 am 
Offline
Site Admin
User avatar

Joined: Thu Mar 01, 2001 7:00 pm
Posts: 1316
Location: Temecula, CA
Yes, you can still explicitly set 8 bits. It just makes it more BS2 compatible to default to 8bits which is why we changed it.

_________________
Tech Support
Basic Micro - Robotic Technology Evolved


Top
 Profile  
 
 Post subject: Re: Shiftin/Shiftout compatibility with BS2
PostPosted: Tue May 03, 2011 3:04 am 
Offline
Master

Joined: Fri Nov 13, 2009 6:28 pm
Posts: 115
Location: Reno, Nevada
Thanks and good job. Many of us started with the BS2 so the more compatible it is, the easier to transition. Appreciate your efforts!

_________________
Harley


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 20 posts ]  Go to page Previous  1, 2

All times are UTC [ 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