I wish to get the voltage increase gradually, keep at a certain level for a certain period, then let it decrease slowly to 0, and repeat this procedure. can any one tell me if Bot Board II allow me to do it and how to program it? Or I need other parts? thank you in advance.
Which chip are you using with the Bot Board 2? The Bot Board 2 itself does not come with a microcontroller.
The chip is “Basic Atom Pro 28 Pin”, Thank you and waiting for your help.
Do you want to measure a voltage or output it?
If you want to measure a voltage between 0 to 5V, you can simply use one of the ADC channels.
If you need to measure more than 5V, you would need a separate voltage sensor.
If you want to output voltage between 0 to 5V, you can again use the ADC channel.
If this does not address your question, perhaps you can tell us a bit more about your application?
Hi, CBenson,
Thank you for your reply.
I want to output voltage between 0 to 5V. For example, when I run the program, the voltage automatically goes up from 0 to 5 in 6-second period, keeps at 5 volts for 3 minutes, then gradually decreases from 5 to 0V in 30 seconds, has a 1 hour break, and repeats the same procedure.
How to make a program for this, and what is the ADC channel? Do not laugh at me–I almost know nothing about these. So please kindly tell me more in detail.
Thank you again.
No need to laugh - we all started at some point.
Do you have the Basic Micro software installed? There should be an example as to how to use analog pins.
Unfortunately at this time we cannot teach how to do this, but there is quite a bit of material online.
I think I have the software installed. I m using it to control my servo.I know how to write a program for running servo (I learnt it from Leximotion several years ago) and I have a full system to control and run servo with Bot Board 2 (and the chip). That project was done well. My new project needs to control the speed of voltage change, but I do not know how to write a program and how to wire it. Can you help with a example program for my purpose and tell me if the output pins are the same as for controlling servo?
Thank you.
The function would be ADIN and pins 0 to 3 and 16 to 19 seem to be associated with analog IO. This is all covered in the Basic Micro Studio Guide.
From the guide, I found a program example that seems most meet my needs:
[code]cs con p0
clk con p1
si con p2
temp vary byte
temp=0
High clk
Main
temp=temp+1
low cs
shiftout si, clk, MSBPRE, (0x11<<8|temp\16]
High cs
pause 25
goto main[/code]
Could you please tell me what these numbers (0, 11, 8 and 16) in “shiftout si, clk, MSBPRE, (0x11<<8)|temp\16]” respectively stands for?
Thank you again.
In the following line:
shiftout si, clk, MSBPRE, (0x11 << 8 | temp \ 16]
The entire expression of [0x11 << 8 | temp \ 16] is in the output data of the function “shiftout”.
0: The “0x” implies that the following digits are in hexadecimal (base 16). You can learn more about it here: en.wikipedia.org/wiki/Hexadecimal
11: The digits “11” represent the value 17 in decimal (base 10) and 10001 in binary (base 2).
8: This number represents how many bits the value to the left of the “<<” operator needs to be shifted to the left. This is the same as multiplying the value by 2^x, where in this case x is 8.
16: According to the Basic Micro Studio Guide, the value 16 is an optional field representing how many bits to be sent.
Therefore, this “shiftout” operation is sending a 16 bit value on the serial port. The value 0x11 is shifted 8 bits to the left, therefore making it a 16 bit value and the “temp” variable, which is 8 bits, is then added to that value (using the logical OR operator, “|”).
On it’s first pass, the value shifted out would be 0001000100000000 in binary (0x1100 in hexadecimal). It would then be increased by 1 every loop, going to 0001000100000001 then 0001000100000010, etc.
If you are a bit (no pun intended) confused about bit manipulation, I suggest you do some more reading on it at cprogramming.com/tutorial/bi … ators.html
Please note that the “shiftout” function is meant for serial communications on interfaces such as SPI. It is not used to output varying voltages**.**
To output a analog voltage directly, the manual recommends using the function “HPWM”. Check page 116-117 of the Basic Micro Studio Guide.
Hope this helps.
Hi, Scharette,
Thank you so much for your reply. I read those two pages (116-117) for the function “HPWM”, but I still do not know how to do.
I want to output voltage between 0 to 5V. For example, when I run the program, the output voltage automatically goes up from 0 to 5 in 6-second period or longer, keeps at 5 volts for 3 minutes or other term, then gradually decreases from 5 to 0V in 30 seconds or slower, has a 1 hour break, and repeats the same procedure.
If you could instruct me in detail to make a program for my project by using HPWM or/and other commands, I would greatly appreciate it.
The Atom offers two PWM functions, the HPWM (Hardware Pulse Width Modulation, works only on specific pins) and the regular PWM (works on most pins). Check here for more details on PWM in general: en.wikipedia.org/wiki/Pulse-width_modulation
You can check an older post (~2006) in our forums on the subject of PWM at: post-p5920?hilit=pwm#p5920
There is also this discontinued tutorial that might offer some help: web.archive.org/web/20060203200 … wmleds.htm
As you may have realized, this product is discontinued and support for it has been dropped a while ago from most sources.
We recommend to check out the forums of the software’s manufacturer to get more information: forums.basicmicro.co.uk/
We cannot offer more support on this product and suggest that you search online for more information.