NEW: Learning electronics? Ask your questions on the new Electronics Questions & Answers site hosted by CircuitLab.
Microcontroller Programming » I can send char as "0xff" or 'f', but if *str = "f", I can't send *str
April 29, 2012 by jeffspc88mx ![]() |
I'm making progress getting my Noritake VFD to respond thanks to all of your help, but now... I can send individual char as either hex ("0xff") or char ('f'), but when I try to send through the pointer (*str), I get garbage out. I'm sifting through my K&R and using Noritake's own example code, but no luck. Here's what I'm doing
The output is garbage, if anything, and not always four characters of garbage. I thought it would print the same garbage twice (because I'm basically sending the string twice), but the garbage changes (although it is longer with two rather than one). Now sending and ('L'), then an ('O'), then a ('V'), and so on works just fine, as does sending the hex equivalents of each character ("0xAB"). But this pointer/array thing is broken. Any ideas? |
---|---|
April 29, 2012 by jeffspc88mx ![]() |
Oops - forgot to change "luv" to "love" - it's a typo in the post, they're the same label in my code - that's not the problem with the code. |
April 30, 2012 by hevans (NerdKits Staff) ![]() |
Hi jeffspc88mx, I'm fairly certain this is happening because of the strings in program memory vs ram issue. There is a good library article about it. Make sure you follow the links at the bottom to the relevant threads, they are full of very good info. |
Please log in to post a reply.
Did you know that you can connect to certain car computers via the OBD-II port with a microcontroller? Learn more...
|