question about the capabilities of the atmel attiny13 on the bs2pe board
andreiu
Posts: 4
hy
i am new here ...i am working on making 2 IR detectors (Sharp GP2D12) interface with my bs2pe motherboard using daughtercard B
from the gpio firmware manual there is nothing mentioned about using the integrated analog to digital converter on analog input 0 and 1 at the same time.Can it be done?
I would like not to use the other coprocessor for the second IR sensor as it's occupied doing something else (driving a 7 segment LCD )
IF anyone can help me i would be more than grateful
PS: sorry for my english if , at times , my way of describing things is akward...
Thank You
i am new here ...i am working on making 2 IR detectors (Sharp GP2D12) interface with my bs2pe motherboard using daughtercard B
from the gpio firmware manual there is nothing mentioned about using the integrated analog to digital converter on analog input 0 and 1 at the same time.Can it be done?
I would like not to use the other coprocessor for the second IR sensor as it's occupied doing something else (driving a 7 segment LCD )
IF anyone can help me i would be more than grateful
PS: sorry for my english if , at times , my way of describing things is akward...
Thank You
Comments
here is my sampling code ...please help me modify it to do alternative sampling on both input analog ports 0 and 1 because i had no luck trying to modify it
thank you again...hope you can help me sort this out...because it's not long before i have to finish my degree paper...
Ps: also cand you please tell me where i can find a more detailed description of gpio firmware commands- i cannot fully understand the arguments between owio and [noparse][[/noparse]%...], i mean the first and second argument (numbers)
Post Edited (andreiu) : 1/26/2010 10:38:05 AM GMT
····www.parallax.com/Portals/0/Downloads/docs/prod/boards/28300-AVR_GPIO-3-0906.PDF
-Phil
Then you also need to look at the documentation for the BS2PE Mobo, which will show you which pins are attached to which of the Tiny13 co-processors in which way:
Finally you need to read the documentation of the GPIO firmware, as already noted, in order to understand the commands being sent. You should work through each of the examples in that document, referring back to the other two I mentioned, until you understand why they work as they do.
You bring up an interesting point about the scattering of documents needed to understand and use the coprocessors. Since I'm the guy who wrote the MoBo docs, could you suggest ways to make the subject more approachable for beginners?
Thanks,
-Phil
One key thing is that in the GPIO documentation, all of the Command Protocol·examples refer to a constant "Owio",·whose value is apparently declared elsewhere in your program - but not shown to the reader. For example, it begins (p.2) with
OWOUT Owio, 0, [noparse][[/noparse]$25]
and then says "this statement will write a digital 1 to port 2, causing it to go high". But of course you can't just type that command - it needs to know what Owio is.
In the margins I have notes clarifying this for myself:
-·I have an arrow coming from "Owio" reading "AVR Commport: 10 for DB'A', 6 for DB'B'" (which information I got from the "Port Summary" table on page 8 of the Mobo documentation).
- Then I have an arrow from the '0' that follows that, reading "byte mode"·(which I got from the OWOUT help file in PBASIC). ·For the second example, I have an arrow going to a note reading "bit mode". I only figured that out when I realized that I had to look up the OWOUT command to understand the examples. It would be helpful to have had a comment (breakout box?) somewhere nearby pointing that out. In particular, the value of Owio is always 10 for coprocessor A and 6 for coprocessor B, right? It wouldn't take much to point that out, and then have a quite "see PBASIC documentation for OWOUT" to explain the "0" after the comma.
I also think that example (the one above) is better than the one used on p.3 to illustrate the Digital Output command, simply because the example on p.3 has some confusing shift stuff in it. It's easier to understand that
$25 means port 2, and then 5 = %0101 which means %010x (digital output) and x = 1 (set·high).
You could have followed up with
$24 means port 2, and then 4 = %0100, set port 2 low.
In short, I really think that one little breakout box next to that first Command Protocol example would make a lot of difference. It took me some time to figure out what Owio should be, and why there's that 0 or 2 or whatever after the example.
(by the way, I think that the way that the commands are defined in GPIO is a great illustration of why we use hex at times in computer science)
Post Edited (sylvie369) : 1/26/2010 6:42:35 PM GMT
and ...can anyone help me modify the code in my previous post so that i can sample analog port 0 and 1 alternatively ?
basically , i am using the A/D converter posibilities of the attiny13 microprocessor - but from my understanding i cannot sample both at the same time but sample them each like mike sugested
Thanks for taking the time. That's a big help!
-Phil
Do you suppose Parallax might·be·interested in a part-time documentation editor?
Andrieu - To sample the two ports alternatively, you should just figure out how to sample port 0, and then copy that code, but replace the address for port 0 with the address for port 1. The analog input command is described on p. 6 of the GPIO docs. There's an example on p.10, using %00001011, ($0B) which, as it explains, samples port 0 (as indicated by the upper four bits being all zeros). If you wanted to sample port 1 the same way, you'd just make the last of those four bits into a 1: %00011011 (which is $1B).
If you're using Hex for your commands, you just make the first digit of the command a 0 for port 0, and a 1 for port 1. That's what I meant when I said that this is why we sometimes write things in Hex - it makes that kind of thing really obvious.