BasicMicro - Forums

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

All times are UTC - 8 hours [ DST ]




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Newbie here, having run problems w/ pro 24-m
PostPosted: Tue Mar 17, 2009 4:05 pm 
Atom Pro 24-M

This compiles cleanly, downloads, etc.
Inputs wiggle (using Tek scope).
Outputs stuck at p4=0, p5=1.
no output movement, at all.

Tried the "traffic light" works OK.

What Now?

Here's my code:
---cut here---
' Atom Pro 24M
' March/17/2009 - PTB
' Two ISF IR distance sensors (proxdot)
' that have TTL outputs (low=active).
'
'spare P0
'spare P1
'spare P2
'spare P3
'spare P4
'spare P5
'spare P6 ' 3v I/O only.
'spare P7 ' 3v I/O only.

'spare P8
'spare P9
'spare P10
'spare P11
'spare P12
'spare P13
'spare P14
'spare P15

' ....................
init:
left con p0 ' input from sensor, proxdot type.
right con p1 ' input from sensor, proxdot type.
cw con p4 ' output to motor driver.
ccw con p5 ' output to motor driver.

input p0 ' proxdot.1, active low.
input p1 ' proxdot.2, active low.

' back to back LED's to simulate a lens motor:
output cw ' 3k ohms to LED1.anode; LED1.cathode to ccw.
output ccw ' 3k ohms to LED2.cathode2; LED2.anode to cw.
high cw
high ccw ' LED's should be off.

' ....................
main:
if left = 0 then goto goccw
if right = 0 then goto gocw
goto main

goccw:
low cw
pause 1000
high cw
goto main

gocw:
low ccw
pause 1000
high ccw
goto main

end
--- cut here---

Paul


Top
  
 
 Post subject: Re: Newbie here, having run problems w/ pro 24-m
PostPosted: Wed Mar 18, 2009 10:08 am 
No answers, heh?
-----------------

OK, I got one, and it works fine:

---cut here---
' Atom Pro 24M

' March/16/2009 - PTB
' Modified: March/18/2009 - PTB

' Two ISF IR distance sensors
' that have TTL outputs (low=active).
' Motor-Driver is tsc427, non-inv ttl->cmos level shifter.

'spare P0 ' left
'spare P1 ' right
'spare P2
'spare P3
'spare P4 ' motor-driver
'spare P5 ' motor-driver
'spare P6 ' 3v I/O only
'spare P7 ' 3v I/O only

'spare P8
'spare P9
'spare P10
'spare P11
'spare P12
'spare P13
'spare P14
'spare P15

' ....................
inits:
left con p0
right con p1
cw con p4
ccw con p5

results var nib
results = $F
' ports PPPP
' bits 3210
goleft con %1110
goright con %1101
'goboth con %1100

' ....................................
input left
input right
output cw
output ccw
high cw
high ccw

' ....................................
'why "ina" works, I have no idea...
main:
results = ina ' bits p0..p3
'debug [dec results,cr] ' seems broken - won't compile.
if results = goleft then goto goccw
if results = goright then goto gocw
goto main

' if a pin goes low & another pin is high - motor rotates.
' swap pins - motor turns other rotation.
' both high - no rotation.
goccw:
low cw
pause 500
high cw
goto main

gocw:
low ccw
pause 500
high ccw
goto main

end
---cut here---

Paul


Top
  
 
 Post subject: Re: Newbie here, having run problems w/ pro 24-m
PostPosted: Wed Mar 18, 2009 10:59 pm 
Offline
Master

Joined: Sun Aug 17, 2008 5:26 pm
Posts: 798
Location: CA bay Area
Nice catch.
Well, it's all in the manual. No, really it is. It's just not cohesive or comprehensive.
For reference, look at the examples under their downloads section. And check out their "10 Projects" book at
http://basicmicro.com/downloads/docs/mbasic_10_projects.pdf
This is written primarily for their MicroBasic compiler, but all their compilers are largely syntactically the same. Most of the code in the book will drop into the Atom series unchanged. Mostly.
'Luck on your project!
kenjj

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


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 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