BasicMicro - Forums

www.basicmicro.com
It is currently Mon May 21, 2012 8:20 pm

All times are UTC - 8 hours [ DST ]




Post new topic Reply to topic  [ 27 posts ]  Go to page Previous  1, 2
Author Message
 Post subject: Re: Port Variable Names not recognized
PostPosted: Thu Oct 28, 2010 11:31 am 
Offline
Master

Joined: Tue Nov 21, 2006 9:34 am
Posts: 528
KM6VV wrote:
Do you mean use ADIN instead? That would be simpler, but it could lead to confusion if ADIN didn't then work for ALL analog inputs.

Yep, there is confusion as the pin numbers used for hservostate for those pins is different than the pins used for ADIN.

Personally I found it confusing that 32 and 33 were used in hservostate as this is what S_IN and S_OUT map to. Also not sure about 34 as this in the information that Nathan posted shows that this is the SCL pin and again this is shown in the Arc32 document. So again this confuses me.

Kurt


Top
 Profile  
 
 Post subject: Re: Port Variable Names not recognized
PostPosted: Thu Oct 28, 2010 5:43 pm 
Offline
Master

Joined: Tue Jun 22, 2010 1:15 pm
Posts: 203
That IS confusing! Is it "Processor Pin labeling" vs "BM Board convention" labeling?

I miss not having a schematic to look at. Or a block diagram for that matter.

I hope to get some more A/D testing done tonight!

hservostate 33 should give VL, according to data sheet. What P# do you thing VL, VS1, VS2 and the AUX one should be on?

Alan KM6VV

KurtEck wrote:
Personally I found it confusing that 32 and 33 were used in hservostate as this is what S_IN and S_OUT map to. Also not sure about 34 as this in the information that Nathan posted shows that this is the SCL pin and again this is shown in the Arc32 document. So again this confuses me.

Kurt

_________________
Visit:
http://groups.yahoo.com/group/SherlineCNC/
http://tech.groups.yahoo.com/group/HexapodRobotIK/


Top
 Profile  
 
 Post subject: Re: Port Variable Names not recognized
PostPosted: Thu Oct 28, 2010 6:24 pm 
Offline
Master

Joined: Tue Nov 21, 2006 9:34 am
Posts: 528
Yep as I said I find it confusing as well.

From a previous post, I believe:
Code:
// P56      VS1         (PB0/AN0)
// P57      VL         (PB1/AN1)
// P58      VS2         (PB2/AN2)

So on the Arc32 you have:
Logical pin P57 (commands like input/output ADIN) connects to the internal H8 pin PB1 which has an alternative pin usage AN1 (i.e. it is an analog input pin), but to use hservostat you must use logical pin 33) which should not in these cases be confused with p33 which is actually S_OUT...

Which is why this section of the pin out table in the Arc32 manual is confusing:
Code:
P32 • Analog Pin.• Detects S1 Voltage.
P33 • Analog Pin.• Detects Logic Voltage.
P34 • Analog Pin.• Detects S2 Voltage.
P35 • Analog Pin.• Detects AUX1 Pin 6 Voltage.
S_IN • UART1 RX.
S_OUT • UART1 TX.
P34 • SCL.• AUX1 Pin 1.
P35 • SDA.• AUX1 Pin 2.
P36 • UART2 TX.• AUX1 Pin 3.

That is there are four pins that are duplicates, but not. It depends on which command is used...

Hopefully I made it as clear as mud :D
Kurt


Top
 Profile  
 
 Post subject: Re: Port Variable Names not recognized
PostPosted: Fri Oct 29, 2010 8:33 am 
Offline
Site Admin
User avatar

Joined: Thu Mar 01, 2001 11:00 am
Posts: 903
Location: Temecula, CA
The argument to hservostate isn't a pin number. It's just an index. But it's easier to think of it as a pin number since 0 to 31 match up to actual pin numbers. We specifically documented that index 32,33,34 and 35 in hservostate are for the 3 power voltages and the AUX1 A/D pin in the new manual.

It was this or add 64 words of code to the library to handle a translation table, or dozens of extra clock cycles to handle conversion of the high pin numbers to the index that stores the data.

This is just like index 0 and 1 in hserial commands don't mean you use P0 and P1 for hserial.

_________________
Tech Support
Basic Micro - Robotic Technology Evolved


Top
 Profile  
 
 Post subject: Re: Port Variable Names not recognized
PostPosted: Fri Oct 29, 2010 9:56 am 
Offline
Master

Joined: Tue Nov 21, 2006 9:34 am
Posts: 528
Acidtech wrote:
The argument to hservostate isn't a pin number. It's just an index. But it's easier to think of it as a pin number since 0 to 31 match up to actual pin numbers. We specifically documented that index 32,33,34 and 35 in hservostate are for the 3 power voltages and the AUX1 A/D pin in the new manual.

I understand this. The difficulty is that they are described as pin number in the Arc32 datasheet. Look at Page 7, it has some pins defined twice with two completely different things associated with them. Likewise HSERVOSTATE in that document describes the parameter as an input pin.

As for other options here. One possible solution would have been to rearrange your port table. That is potentially you could have made VL, VS1, VS2 and the the analog pins to be logically pins number:
34-37, as I don't think of the external code depends on the actual pin numbers for the other items after S_OUT... Could be wrong. You are already having to handle pin number >=32...

Then the next question is do you need to handle these at all in hservostate? Or can you handle them with ADIN? My guess is if you have enabled HSERVO you have to use hservostate as you probably muck with the AtoD registers as part of your interrupt code and as such probably ADIN will not work.

Kurt


Top
 Profile  
 
 Post subject: Re: Port Variable Names not recognized
PostPosted: Fri Oct 29, 2010 10:37 am 
Offline
Master

Joined: Tue Jun 22, 2010 1:15 pm
Posts: 203
Yes, I noticed the table. Perhaps the command type could be included, if I understand you correctly.

I'd consider defining a set of constants for the pin names, 33 for ADIN might become 33AD (or SOUT, of course). Hservostat 33 could become HS33. Actually, if we have macros, then they could be made to appear more like a subroutine call passing the port #. (which is probably what they are?).

Does the BAP compiler even know about the "raw" uP pin numbers like //P56? I know you are writing C (and Basic) library commands, and use these designations, and that we need to be able to relate to the actual hardware pins on the uP, but yeah, I can still be called "confused" until I can work through some of these pin references in working code on my 'bot.

A link to the HBRobotics "Table Top Challange" pix and videos. Micromoose and I are in it, I've got a bright blue shirt on.

http://picasaweb.google.com/DruaiRobotics/HomebrewRobotics102710#

ARC-32 and RoboClaw on board! Also a BAP.

Thanks!

Alan KM6VV


KurtEck wrote:
Yep as I said I find it confusing as well.

From a previous post, I believe:
Code:
// P56      VS1         (PB0/AN0)
// P57      VL         (PB1/AN1)
// P58      VS2         (PB2/AN2)

So on the Arc32 you have:
Logical pin P57 (commands like input/output ADIN) connects to the internal H8 pin PB1 which has an alternative pin usage AN1 (i.e. it is an analog input pin), but to use hservostat you must use logical pin 33) which should not in these cases be confused with p33 which is actually S_OUT...

Which is why this section of the pin out table in the Arc32 manual is confusing:
Code:
P32 • Analog Pin.• Detects S1 Voltage.
P33 • Analog Pin.• Detects Logic Voltage.
P34 • Analog Pin.• Detects S2 Voltage.
P35 • Analog Pin.• Detects AUX1 Pin 6 Voltage.
S_IN • UART1 RX.
S_OUT • UART1 TX.
P34 • SCL.• AUX1 Pin 1.
P35 • SDA.• AUX1 Pin 2.
P36 • UART2 TX.• AUX1 Pin 3.

That is there are four pins that are duplicates, but not. It depends on which command is used...

Hopefully I made it as clear as mud :D
Kurt

_________________
Visit:
http://groups.yahoo.com/group/SherlineCNC/
http://tech.groups.yahoo.com/group/HexapodRobotIK/


Top
 Profile  
 
 Post subject: Re: Port Variable Names not recognized
PostPosted: Fri Oct 29, 2010 10:46 am 
Offline
Master

Joined: Tue Jun 22, 2010 1:15 pm
Posts: 203
The actual pin numbers sound the most usable. Let me get more time on the board.

In C, we write functions; library calls look like function calls. I guess I miss the parens (). When you code hservostate, it takes an argument, but doesn't look much like a gosub with arguments. Just curious how that all works out. I know, I should stop trying to make Basic look like C. ;>)

In addition to getting the A/D working for reading my new sensors, I hope to get a parallel (later, a serial) LCD connected up and coded this weekend. Should be no big deal.

Thanks!

Alan KM6VV

Acidtech wrote:
The argument to hservostate isn't a pin number. It's just an index. But it's easier to think of it as a pin number since 0 to 31 match up to actual pin numbers. We specifically documented that index 32,33,34 and 35 in hservostate are for the 3 power voltages and the AUX1 A/D pin in the new manual.

It was this or add 64 words of code to the library to handle a translation table, or dozens of extra clock cycles to handle conversion of the high pin numbers to the index that stores the data.

This is just like index 0 and 1 in hserial commands don't mean you use P0 and P1 for hserial.

_________________
Visit:
http://groups.yahoo.com/group/SherlineCNC/
http://tech.groups.yahoo.com/group/HexapodRobotIK/


Top
 Profile  
 
 Post subject: Re: Port Variable Names not recognized
PostPosted: Mon Nov 01, 2010 8:41 am 
Offline
Site Admin
User avatar

Joined: Thu Mar 01, 2001 11:00 am
Posts: 903
Location: Temecula, CA
The BAP compiler doesn't know anything about Renesas pin numbers. The assembler does, but not the way you'd think(eg you'd have to use a PDR port register with the Renesas pin number in a bit set command or use a compile time shift to conver tthe Renesas pin number into a port mask).

Especially with the ARC32, there are several gotchas going from Basic to C or C to Basic.

The hservostate command is a function in Basic, just like all the math functions(+-*/ abs etc...). Functions are re-entrant which means they can be used in an expression(eg if (hservostate(p0)=1)then...). This is true of functions in C as well.

Commands in Basic are not re-entrant so they can not be used in expressions.

_________________
Tech Support
Basic Micro - Robotic Technology Evolved


Top
 Profile  
 
 Post subject: Re: Port Variable Names not recognized
PostPosted: Mon Nov 01, 2010 12:21 pm 
Offline
Master

Joined: Tue Jun 22, 2010 1:15 pm
Posts: 203
Sounds complicated! Thanks for the explanations.

Acidtech wrote:
Functions are re-entrant which means they can be used in an expression(eg if (hservostate(p0)=1)then...). This is true of functions in C as well.

Commands in Basic are not re-entrant so they can not be used in expressions.


So commands are a little different from functions then? I'm just lumping them all together in my thinking.

Thanks!

Alan KM6VV

_________________
Visit:
http://groups.yahoo.com/group/SherlineCNC/
http://tech.groups.yahoo.com/group/HexapodRobotIK/


Top
 Profile  
 
 Post subject: Re: Port Variable Names not recognized
PostPosted: Sun Nov 21, 2010 11:04 am 
Offline
Citizen

Joined: Wed Oct 29, 2008 3:47 am
Posts: 12
Hi,

I didn't wan't to start a new thread for a single Q. But can someone tell me if there is a 3,3v output on the ARC32 board? I'm going to connect a IMU 6DOF razor that need 3,3v. Any hint would be appreciated! :)


Top
 Profile  
 
 Post subject: Re: Port Variable Names not recognized
PostPosted: Sun Nov 21, 2010 11:45 am 
Offline
Master

Joined: Tue Nov 21, 2006 9:34 am
Posts: 528
Hi Zenta,

If you are asking do any of the IO pins output 3.3v when the IO pin is set to high, my guess would be to try SDA/SCL pins (P34 and P35). If you are asking if there are any power pins that output a regulated 3.3v, I don't know of any.

Kurt


Top
 Profile  
 
 Post subject: Re: Port Variable Names not recognized
PostPosted: Sun Nov 21, 2010 2:25 pm 
Offline
Citizen

Joined: Wed Oct 29, 2008 3:47 am
Posts: 12
KurtEck wrote:
If you are asking if there are any power pins that output a regulated 3.3v, I don't know of any.


Hi Kurt,

Yes that's what I'm asking for. I guess I've to add my own regulator then.


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

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