Processor

Status
Not open for further replies.

jrm850

Senior Member
ECF Veteran
Jun 18, 2011
159
21
Southeastern US
Very cool clutchjunkie. Is that the Ti launchpad I see in the pic? Let us know how you like the little chips and the development environment.

I don't know how the arduino language goes about adjusting the timer prescaler on the AVR but by doing so you should be able to use the built in PWM functions at your 666hz if you wanted to. I personally would probably go about it just like you did for this application, but it is there if you want to play.

What does the arduino do when your pulse duraton is longer than your 1.5ms period? I'm not sure but I think you only have 5 steps of resolution before you run into this condition unless the 1500 is not a fixed period.

digitalWrite(Cfire, HIGH);
delayMicroseconds((VpowerLevel * 250)+400); //ON pulse

digitalWrite(Cfire, LOW);
delayMicroseconds(1500); //OFF pulse
}

EDIT:I see now that the off time is always 1500uS.
 
Last edited:

jrm850

Senior Member
ECF Veteran
Jun 18, 2011
159
21
Southeastern US
Some suggestions for your code...

dimension an eeprom variable to store your vpowerlevel when the uC is depowered. That way your PV will always start where you left it.

Add another vpowerlevel variable to help with the math conversion so that it will be easier to limit your pulse range from the 648-1500uS range and give you much more control over resolution and the number of steps. (For those of you interested the 648 number is significant in his code because this represents the 3.2vrms lower level target. CJ reached this number in his code with +400 part of his output statement)

If you do something like:
vpowerlevel2 =vpowerlevel*85.2 '10 steps in your 852 PW range. remember to dim as a single for decimal use.
if vpowerlevel2 <= 648 then vpowerlevel2=648 ' lower limit of 3.2rms
digitalWrite(Cfire, HIGH);
delayMicroseconds((VpowerLevel2 ); //ON pulse
digitalWrite(Cfire, LOW);
delayMicroseconds(1500-vpowerlevel2); //OFF pulse

This last step, assuming that I am interpreting the language correctly, keeps your frequency at 666hz instead of adding on+off pulses together. i.e 648uS on time +1500uS off time= 2148uS. This will make your RMS form a 7.4v source 2.2v instead of the 3.2 you will get if the period is fixed at 1500uS.

Do the same with the up button routine and limit to>=1500


If you run into floating point math issues just dimension your variables as singles. (you shouldn't have to worry about memory space with this application so it won't matter if you waste the space with a single)

You can also set a simple timer to gosub pulse out routine. If the clock speed on the nano is 16mhz then an 8 bit timer with a prescale of 64 will trigger an overflow interrupt roughly every 1000uS.

If this is your first attempt at writing uC code, I am very impressed. Your understanding is light years ahead of where I was when I first started with "Hello World" :)
 

clutchjunkie

Senior Member
ECF Veteran
Jan 29, 2011
144
19
48
SoCal
My next step is to add an eeprom data save like jrm850 mentioned, as well as experiment with analog voltage reading and atty ohm reading. I am also planning on adding another button, the "menu" button.

I just got done coding up a 7-segment led routine to replace the up/down leds. This now shows VpowerLevel as an actual number from 1-0 with "0" being 10. The menu button will switch this display to a rough battery indicator or ohm indicator, as well as allowing for more user adjustable options.

I have also given up on the msp430 launchpad for now. It is such a PITA just to get the software to do what I want, let alone actually generate any code. Not to mention that all the sample programs I find look like someone typed "void loop()" then randomly pounded on the keyboard.

I will post the code up after I look into the reading of the volts/ohms a bit, no need to flood the forum with code every time i change a little thing here or there.
 

jrm850

Senior Member
ECF Veteran
Jun 18, 2011
159
21
Southeastern US
I wanna order one of these boards. Which one is better Arduino Nano or TI Launchpad?

The Arduino is going to be a LOT more user friendly and Clutchjunkie has already posted working code for this application. The Ti will offer more flexibility and the option of smaller boards, but at a cost of a steeper learning curve. If you are developing a product for resale the Ti wins hands down because of chip cost. If this is a one off for your use, the Arduino is probably the way to go. The Arduino might have the most internet support of all of the options.

The Ti Launchpad is similar to Pic and AVR development tools but it cost less to get started. There is a ton of internet support for the PICs, a good amount for the AVR, and as far as I can tell not too much for the Ti launchpad yet. They all have advantages over the other so you just need to pic your poison.
 

solarisx

Full Member
Sep 7, 2010
63
1
Cali
I already ordered the TI launchpad. It was so cheap I couldn't resist, and I ordered a sample uP also. I worked with AVRs and PICs a couple years ago. They were handy. Time to play with a new toy now. I don't have any wire, connector, soldering iron. Basically I only have a multimeter. What is the cheapest online place for ordering that stuff?
 

Chip_

Senior Member
ECF Veteran
Jul 23, 2011
87
38
Texas
I have also given up on the msp430 launchpad for now. It is such a PITA just to get the software to do what I want, let alone actually generate any code. Not to mention that all the sample programs I find look like someone typed "void loop()" then randomly pounded on the keyboard.

.

What kind of problems are you encountering?

Is it the IDE navigation that is giving you problems?

IF you gave up on the Launchpad, what are you using instead?

This darn TI thinggy is so cheap I am going to order the darn thing. :rickroll:





I have been programming MCU's since 1984, and have fairly broad base of MCU background.

But your statement is ineresting, in that typically if you wanna do this or that, you gotta cough up big bucks, to get the software/hardware to support you. Is this what's happening to you?
 

Chip_

Senior Member
ECF Veteran
Jul 23, 2011
87
38
Texas
I already ordered the TI launchpad. It was so cheap I couldn't resist, and I ordered a sample uP also. I worked with AVRs and PICs a couple years ago. They were handy. Time to play with a new toy now. I don't have any wire, connector, soldering iron. Basically I only have a multimeter. What is the cheapest online place for ordering that stuff?

Try Harbor Freight tools. Search results for: 'Soldering Iron'

:laugh:
 

CraigHB

Ultra Member
ECF Veteran
Jul 31, 2010
1,249
314
Reno, Nevada
I have been programming MCU's since 1984, and have fairly broad base of MCU background.

I have a question for you. I was looking at the ARM Cortex based parts, don't have any experience with that core yet. The low range parts from NXP and STM are comparable in price to many 8 and 16 bit parts out there. I was wondering if there are inexpensive development tools for them. What do you use to program and debug?
 

Chip_

Senior Member
ECF Veteran
Jul 23, 2011
87
38
Texas
I have a question for you. I was looking at the ARM Cortex based parts, don't have any experience with that core yet. The low range parts from NXP and STM are comparable in price to many 8 and 16 bit parts out there. I was wondering if there are inexpensive development tools for them. What do you use to program and debug?

To be honest with you, I am very leary of TI processors. Back in the late 80's I used their line of MCU TMS7000 family, for a rocket warhead project. Well sir, there ain't no such thing as the TMS7000 family anymore. So I have generally stayed away from them since then. However, this darn Launchpad is so cheap, and this will be just for fun, and for me, so I will do it. But never, never will I specify them for a formal project, ever again. As a result I can't speak to the ARM Cortex TI product line.

As far as what I use for development, the only common link amongst the various families, is C/C++. Usually they all have their own IDE's and supporting compilers. So there really isn't a common Debug and development tool, other than those free GNU things, which I don't always like or trust, since they usually come repleat with bugs that you have to ferret out, as related to the core you are using.

I did use that free GNU Platform about year ago, it wasn't bad, but like I said, there were moments when I was pulling my hair out. I would much prefer to pay for the thing - especially when it's only $4.35.
:2cool:
 

jrm850

Senior Member
ECF Veteran
Jun 18, 2011
159
21
Southeastern US
To be honest with you, I am very leary of TI processors. Back in the late 80's I used their line of MCU TMS7000 family, for a rocket warhead project. Well sir, there ain't no such thing as the TMS7000 family anymore. So I have generally stayed away from them since then. However, this darn Launchpad is so cheap, and this will be just for fun, and for me, so I will do it. But never, never will I specify them for a formal project, ever again. As a result I can't speak to the ARM Cortex TI product line.

As far as what I use for development, the only common link amongst the various families, is C/C++. Usually they all have their own IDE's and supporting compilers. So there really isn't a common Debug and development tool, other than those free GNU things, which I don't always like or trust, since they usually come repleat with bugs that you have to ferret out, as related to the core you are using.

I did use that free GNU Platform about year ago, it wasn't bad, but like I said, there were moments when I was pulling my hair out. I would much prefer to pay for the thing - especially when it's only $4.35.
:2cool:

Warheads? Technology that explodes is the coolest man stuff ever. :) I can see it now... "Introducing the newest ultimate PV, the WARHEAD. The throat hit is killer!"
 

clutchjunkie

Senior Member
ECF Veteran
Jan 29, 2011
144
19
48
SoCal
Now that I have gotten into Arduino a little more, I am finding that the platform is a lot more flexible than I originally thought. Turns out that you can run the Atmega8/168/328 chips off of the internal oscillator, which drops the part count down a bit. Also, the Atmega8 smd chip is only $2-$3 and I found breakout boards for it for .80. You can write a program to one of these from your arduino and then just stick the chip in your end project, but you will need an arduino board that has the removable chip option.

Right now I have a pretty solid program running and I am testing things like TH, vapor, and flavor at different frequencies to see if there is a sweet spot somewhere in the kHz range.
 

jrm850

Senior Member
ECF Veteran
Jun 18, 2011
159
21
Southeastern US
Now that I have gotten into Arduino a little more, I am finding that the platform is a lot more flexible than I originally thought. Turns out that you can run the Atmega8/168/328 chips off of the internal oscillator, which drops the part count down a bit. Also, the Atmega8 smd chip is only $2-$3 and I found breakout boards for it for .80. You can write a program to one of these from your arduino and then just stick the chip in your end project, but you will need an arduino board that has the removable chip option.

Right now I have a pretty solid program running and I am testing things like TH, vapor, and flavor at different frequencies to see if there is a sweet spot somewhere in the kHz range.

That's pretty cool that you can use the Arduino as discreet development environment. I wonder if the Arduino compler requires a bootloader or whether you could just use the built in 6 pin ISP that almost all AVRs support? If you can use the 6 pin ISP then all of the AVR line opens up including the tiny series.

Can you access the registers directly with statements like Tccr1a = &B01000010?
 

clutchjunkie

Senior Member
ECF Veteran
Jan 29, 2011
144
19
48
SoCal
That's pretty cool that you can use the Arduino as discreet development environment. I wonder if the Arduino compler requires a bootloader or whether you could just use the built in 6 pin ISP that almost all AVRs support? If you can use the 6 pin ISP then all of the AVR line opens up including the tiny series.

You can use the Arduino itself as an ISP, there is a program and wiring diagram on the Arduino website. The Arduino then becomes an ISP. Normally, you would burn the Arduino bootloader onto the chip first, but there is a way around that now too.

I hear a lot about the tiny series, I may have to look into that more.

Can you access the registers directly with statements like Tccr1a = &B01000010?

There is a way, I know I will have to figure it out because you have to do that to use the internal oscillator. My end goal is to get my program just right, then burn it onto atmega8/168's with no bootloader and of course the internal oscillator. I am going to play around with some display options as well, right now I have a 7 segment LED and I think I will need two of those. I have been able to find touchscreen lcd's that are cheap enough to be in the realm of possibility though, but that seems like a bit of overkill. I want to display more information, but I don't want to overcomplicate it.
 

CraigHB

Ultra Member
ECF Veteran
Jul 31, 2010
1,249
314
Reno, Nevada
For code development, some kind of in-circuit programming is ideal. I dedicate a couple IO pins to programming with the MCUs I've been using. I use a programming header on the board for code development then remove it when I'm done.

My latest mod uses a two digit segment LED. The downside with those is you need 15 pins to control them (14 segments and a period). You can either use a shift register or a high pin count MCU to drive the display. I thought an LED display would be cool, but I'm not happy with it. You can't see the digits in direct sunlight and with only 2 of them, there's not much information you can display. The mod I'm currently working on will use a serial text mode display which has 32 characters, two lines with 16 per line. I'll be able to display a lot more information and driving it only requires 4 pins instead of 16. You can also use a serial graphic display if you want, but somewhat more involved to program. Check out the COG displays, they're highly compact.
 

Java_Az

Ultra Member
ECF Veteran
Verified Member
Aug 29, 2010
2,071
216
Colorado
I got a 16x2 LEd for pretty cheap off ebay via the slow boat from china. It only took 9 days to get here. Mainly got it for the launch pad but was hoping to maybe get one in a mod. They are kinda on the big side though even if i switch out to a li po batteries i dont think i can fit it in my current design. Here is a link $3.19 shipped is not a bad deal i thought. HD44780 1602 16x2 LCM Character LCD Display Module New | eBay
 
Status
Not open for further replies.

Users who are viewing this thread