Show Posts
Pages: 1 ... 61 62 [63] 64 65 ... 110
931  Using Arduino / Microcontrollers / Re: Need optiboot mega8 8mhz HEX and LST on: October 16, 2012, 08:37:58 am
with strong hardware background i can say even cheapo ebay crystals are much more accurate than that. few ppm.
Yeah sorry that was a typo, I meant to say <0.01%, but even that is on the high side - generally 20ppm is a standard figure.

It is possible that the RC is working better at 115200 baud as it's frequency is calibrated in such a way that the % error is reduced.

Interestingly if the U2X bit is a 0, the error is +8.5%, but it it is set to a 1, that gets reduced to -3.5%. Optiboot uses the U2X bit, so the error in baud rate should be 'acceptable' (not great - in comparison 57600B results in a 2.1% error)
932  Using Arduino / Microcontrollers / Re: Need optiboot mega8 8mhz HEX and LST on: October 16, 2012, 07:52:01 am
Just FYI, a crystal is accurate to within <0.1%. It is possible that you didn't set the fuse settings correct for an 8MHz crystal.
933  Using Arduino / Microcontrollers / Re: Need optiboot mega8 8mhz HEX and LST on: October 16, 2012, 07:26:37 am
Yeah, sorry that version of the folder is from my laptop, I created the mega8 batch file on my desktop. Either you can make your own, or i can upload the one I made this evening.
If you make your own you will have to modify the makefile to add an 8MHz entry.
934  Using Arduino / Microcontrollers / Re: Need optiboot mega8 8mhz HEX and LST on: October 16, 2012, 06:44:03 am
Here is my optiboot folder. I have made a batch file which redirects calls to the missing files to the correct folder so windows can find them.
935  Using Arduino / Microcontrollers / Re: Programming an ATtiny85 with Arduino Code and Arduino Uno as Programmer on: October 15, 2012, 02:32:37 pm

The blue wire does not look correct.

In that diagram the black wire above the blue wire should be one hole to the left - I think the blue is correct.
936  Using Arduino / Microcontrollers / Re: Need optiboot mega8 8mhz HEX and LST on: October 15, 2012, 02:30:27 pm
i got the 57.6k version running like a charm so problem solved. thank you very much. it has saved me a lot of time and hassle. the 115.2k dont work but maybe expected what with divisor and cable issues

Yeah, at 8MHz, 115200 is really pushing it (I think there is about a 6% error). Normally I use 115200 for 16MHz, and 57600 for 8MHz.
937  Using Arduino / Microcontrollers / Re: Need optiboot mega8 8mhz HEX and LST on: October 15, 2012, 12:40:50 pm
Here you go. The makefile generates a .lst file as well.
938  Using Arduino / Microcontrollers / Re: Programming an ATtiny85 with Arduino Code and Arduino Uno as Programmer on: October 15, 2012, 12:28:53 pm
Do the lights on the Arduino blink when you try and upload?
939  Using Arduino / Microcontrollers / Re: Need optiboot mega8 8mhz HEX and LST on: October 15, 2012, 12:13:33 pm
The last post in that thread you posted a link to is an 8MHz version.

EDIT: Oh right, i see what you mean about the offset.
What Baud rate would you like? I will compile it for you.

Edit (again):
As it is quick to do, here are two common Baud rates:
57600B
Code:
:101E000011248FE594E09EBF8DBF84B714BE81FF7F
:101E1000D5D085E08EBD82E08BB988E18AB986E8AD
:101E200080BD80E189B98EE0B5D0BD9A96E028E109
:101E30003EEF40E23DBD2CBD88B7846088BF08B648
:101E400002FEFDCF88B3842788BBA895915091F7F7
:101E5000CC24DD244424439435E0632E21E1522E2A
:101E600093E0792E90D0813461F48DD0082F96D0F4
:101E7000023811F0013811F484E001C083E07FD012
:101E80007BC0823411F484E103C0853419F485E009
:101E90008DD072C0853541F476D0A82E74D0B82E7E
:101EA000AA0CBB1C650167C0863521F484E07ED096
:101EB00080E0E5CF843609F039C065D064D0082FC2
:101EC00062D020E0C21628E1D20618F4F60177BEEF
:101ED000E895C0E0D1E057D089930C17E1F7F0E026
:101EE000CF16F8E1DF0618F0F60177BEE89556D078
:101EF00007B600FCFDCFC601A0E0B1E08C901196C2
:101F00009C9011971296FC01040147BEE89511249C
:101F10000296F1E0A034BF0789F7F60167BEE895A5
:101F200007B600FCFDCF57BEE89526C08437B1F454
:101F30002AD029D0E82E27D031D0F601FE2C8F01EF
:101F40000F5F1F4F84911BD0FA94F801C1F70894DA
:101F5000C11CD11CEA94CE0CD11C0EC0853739F4BB
:101F60001DD08EE10CD083E90AD087E088CF81357F
:101F700011F488E00FD012D080E101D073CF5D9BC7
:101F8000FECF8CB908955F9BFECF5C9901C0A895E8
:101F90008CB1089598E191BD81BD0895F4DF803240
:101FA00019F088E0F7DFFFCF84E1E9CF1F93182F06
:101FB000EADF1150E9F7F2DF1F91089580E0EADFD0
:061FC000EE27FF27099443
:021FFE000404D9
:0400000300001E00DB
:00000001FF

115200B:
Code:
:101E000011248FE594E09EBF8DBF84B714BE81FF7F
:101E1000D5D085E08EBD82E08BB988E18AB986E8AD
:101E200080BD88E089B98EE0B5D0BD9A96E028E102
:101E30003EEF40E23DBD2CBD88B7846088BF08B648
:101E400002FEFDCF88B3842788BBA895915091F7F7
:101E5000CC24DD244424439435E0632E21E1522E2A
:101E600093E0792E90D0813461F48DD0082F96D0F4
:101E7000023811F0013811F484E001C083E07FD012
:101E80007BC0823411F484E103C0853419F485E009
:101E90008DD072C0853541F476D0A82E74D0B82E7E
:101EA000AA0CBB1C650167C0863521F484E07ED096
:101EB00080E0E5CF843609F039C065D064D0082FC2
:101EC00062D020E0C21628E1D20618F4F60177BEEF
:101ED000E895C0E0D1E057D089930C17E1F7F0E026
:101EE000CF16F8E1DF0618F0F60177BEE89556D078
:101EF00007B600FCFDCFC601A0E0B1E08C901196C2
:101F00009C9011971296FC01040147BEE89511249C
:101F10000296F1E0A034BF0789F7F60167BEE895A5
:101F200007B600FCFDCF57BEE89526C08437B1F454
:101F30002AD029D0E82E27D031D0F601FE2C8F01EF
:101F40000F5F1F4F84911BD0FA94F801C1F70894DA
:101F5000C11CD11CEA94CE0CD11C0EC0853739F4BB
:101F60001DD08EE10CD083E90AD087E088CF81357F
:101F700011F488E00FD012D080E101D073CF5D9BC7
:101F8000FECF8CB908955F9BFECF5C9901C0A895E8
:101F90008CB1089598E191BD81BD0895F4DF803240
:101FA00019F088E0F7DFFFCF84E1E9CF1F93182F06
:101FB000EADF1150E9F7F2DF1F91089580E0EADFD0
:061FC000EE27FF27099443
:021FFE000404D9
:0400000300001E00DB
:00000001FF

I haven't posted the lst files as they are not necessary. If you want them I can post them.
Note that this my own modified version of optiboot, but it works the same - there were just some improvements in efficiency.
940  Using Arduino / Microcontrollers / Re: Programming an ATtiny85 with Arduino Code and Arduino Uno as Programmer on: October 15, 2012, 11:39:32 am
You *may* need a 10k pullup resistor on the reset pin (between pin1 and pin8).  All the other connections appear correct.
941  Using Arduino / Microcontrollers / Re: How to access unused pins on an atmega1280? on: October 14, 2012, 06:01:10 am
You don't need to worry about those lines unless you plan to use PJ2 as a pin change interrupt. However if you do, I have modified them for you:
Code:
#define digitalPinToPCICR(p)    ( (((p) >= 10) && ((p) <= 13)) || \
                                  (((p) >= 50) && ((p) <= 53)) || \
                                  (((p) >= 62) && ((p) <= 69)) || \
 ((p) == 70) ? (&PCICR) : ((uint8_t *)0) )

#define digitalPinToPCICRbit(p) ( (((p) >= 10) && ((p) <= 13)) || (((p) >= 50) && ((p) <= 53)) ? 0 : \
                                ( (((p) >= 62) && ((p) <= 69)) ? 2 : \
                                ( ((p) == 70) ? 1 : 0 ) ) )

#define digitalPinToPCMSK(p)    ( (((p) >= 10) && ((p) <= 13)) || (((p) >= 50) && ((p) <= 53)) ? (&PCMSK0) : \
                                ( (((p) >= 62) && ((p) <= 69)) ? (&PCMSK2) : \
                                ( ((p) == 70) ? (&PCMSK1) : ((uint8_t *)0) ) ) )

#define digitalPinToPCMSKbit(p) ( (((p) >= 10) && ((p) <= 13)) ? ((p) - 6) : \
                                ( (((p) >= 50) && ((p) <= 53)) ? (53 - (p)) : \
                                ( (((p) >= 62) && ((p) <= 69)) ? ((p) - 62) : \
                                ( ((p) == 70) ? 3 : 0 ) ) ) )

---------------------------------------------------------------------------------------

In order to get a new pin to work, you need to do a several steps:
(1) at the end of this:
Code:
const uint8_t PROGMEM digital_pin_to_port_PGM[]
add this:
Code:
PJ , // PJ 2 ** 70 ** D70
This specifies which port the pin is on (in this case J)

(2) at the end of this:
Code:
const uint8_t PROGMEM digital_pin_to_bit_mask_PGM[]
add this:
Code:
_BV( 2 ) , // PJ 2 ** 70 ** D70
This specifies a bit mask for this pin in its port (In this case it is the bitmask for pin 2)

(3) at the end of this:
Code:
const uint8_t PROGMEM digital_pin_to_timer_PGM[]
add this:
Code:
NOT_ON_TIMER , // PJ 2 ** 70 ** D70
This specifies that it is not a PWM output (which it is not)

(4) at the to, change this:
Code:
#define NUM_DIGITAL_PINS            70
to this:
Code:
#define NUM_DIGITAL_PINS            71
This tells the IDE there are now 71 useable pins not 70.

Then restart the IDE and try to run the code. It *should* work.
942  Using Arduino / Programming Questions / Re: How do we copy a section of a char array that doesn't start at the beginning? on: October 13, 2012, 08:39:05 pm
I'm afraid you may have to wait until Monday or Tuesday for version 3.1 as I had to work Saturday, so didn't get a chance to finish writing the new examples.
943  Using Arduino / Programming Questions / Re: How do we copy a section of a char array that doesn't start at the beginning? on: October 12, 2012, 02:26:31 pm
If you are trying to text wrap with the gLCD library, that feature will be built into v3.1 which should be ready tonight or tomorrow.

I'm curious how you will handle this.
There are many little issues and options related to wrapping, newline vs <CR> processing, and how
to handle things when you reach the very last character of a line and the bottom line of a text area.
For example, does <CR> wrap back to column 0?  To allow easy over writing of the line.
If so, you can can't drop the cursor position to the next line until you print the next character *after*
the wrap point.
Otherwise you won't be able to draw a full line of text and overwrite it by using <CR>.

Does the full line of text on the line being wrapped to get fully erased when an auto wrap/newline occurs?

Then there is the issue of how to handle wrapping of the very last line.
Does the text area scroll after that, does the text wrap to the top line or does it just start
throwing away the text.

The most painful to deal with is supporting a single line text area.
Users want and expect to be able to do this:
lcd.println("my new line");
And have each line show up erasing the previous line.
But technically if you process the newline as you see it, and support scrolling, or automatically
erasing a line that is wrapped to, you end up scrolling out the very line that they just printed.

In the big picture, handling this single line case is the same as having to deal with allowing
printing of a full line when you support erasing the line wrapped to.
You have to defer the wrap and newline processing until *after* the next character after the wrap
point is printed.

Lots of little details to think about.

--- bill

Basically text wrapping is part of the font. In order to have compatibility with older programs that don't expect wrapping:
setFont(someFont);
prints the font with text wrapping disabled.

To turn it on, you would use this:
setFont(someFont, WrapText);
Where wrapText is a #defined constant. It will automatically turn off again next time you set the font.


If the text goes beyond the bottom of the screen, in the current version it is just truncated. The size returned from the write() function in arduino 1.0+ is reduced to the number of characters actually printed.
When the end of a line is reached, if there is not enough space on the line for another character, the rest of the line from the end of the prior character to the edge of the screen is filled with the background colour (unless the background is transparent), and the character is printed just below on the next line.
Conversely if a '\n' is used to drop to a new line, the end of the line (from the end of the last character on the line to the edge of the screen) is not filled in the background colour.

At the moment it doesn't account for whole words, so it just chops the string mid word. In future versions I may add the ability to wrap in a way which keeps whole words together, but to keep printing as fast as possible, this is not yet implemented.

Furthermore, the last line of a wrapped string does not currently blank the full line, only what is needed. I might add an option to allow the bounding box of the printed text to be set to the background colour.
944  Using Arduino / Programming Questions / Re: How do we copy a section of a char array that doesn't start at the beginning? on: October 12, 2012, 11:13:52 am
If you are trying to text wrap with the gLCD library, that feature will be built into v3.1 which should be ready tonight or tomorrow.
945  Using Arduino / Displays / Re: Nokia LCD display shield question on: October 11, 2012, 06:40:13 pm
I have simplified one of the functions from my my MP3 Player. This basically displays data from a string which you supply, scrolling it around by 1 character each time the function is called.
Code:
//Scroll through songInfo, shifting 1 characters each time
void printScroll(char* songInfo, byte infoLength, boolean start = false);
void printScroll(char* songInfo, byte infoLength, boolean start){
  static unsigned int tagPosition = 0;
  if(start){
    tagPosition = 0;
  }
  
  char stringRecover[23] = {0};
  strncpy(stringRecover,&songInfo[tagPosition], 22); //22 character substring starting at [tagPosition]
  
  graphic.setCoordinate(0,70);
  graphic.print(stringRecover);
  
  tagPosition += 1;
  if (tagPosition >= infoLength - 21){ //subtracting 21 as the last 21 characters are the same as the first.
    tagPosition = 0;
  }
}

The function does not check the length of the string you supply (I took too much time for my particular project), so you need to ensure that the string is at least 43 characters long, and that the last 21 characters are the same as the first. For example:

"Hello, this string is more than 22 characters longHello, this string is"; //Noting that the last 21 characters are the same as the first.
"Hello,                    Hello,                   "; //This string is padded with spaces to ensure that it is the correct length.

You could use something like this function to automatically format the string and scroll it:
Code:
....
  //This code calls the scroll funtion
  char string[] = "Hello, this is the string I wan't to scroll around the screen";
  scrollString(string, 50); //scroll the string 50 places to the right (will loop around as necessary).

...

void scrollString(char* suppliedString, byte n){ //Formats then scrolls the string around the screen n times.
  int length = strlen(suppliedString);

  char string[length < 22? 44: length + 22];  //create a longer buffer of minimum size 44 characters (22 + 21 + null).

  strcpy(string, suppliedString); //Copy the supplied string into the new buffer

  //check the length of the string:
  if (length < 22){
    //String is too short!
    memset(string + length, ' ', 22 - length); //so pad with spaces up to the required length
    string[22] = 0; //re null terminate (we just overwrote the null with a ' ')
    length = 22; //string is now 22 characters long
  }
  
  //Now append the first 21 characters to the end to allow wrap around (so the string can scroll around the screen continuously)
  char stringRecover[22] = {0};
  strncpy(stringRecover,string,21);
  sprintf(string + length,"%s",stringRecover); //Add the first 21 chars onto the end of songInfo to make it easier to loop through later

  length = strlen(string);
  printScroll(string, length, true); //initial print to the screen, reset loop position to the start.

  for (byte i = 0; i < n - 1; i++){
     printScroll(string, length); //shift around the screen n times.
  }
}

(Just to note, the formatting function hasn't been tested beyond it compiling as I don't have a screen to hand, but I know the printing function works).
Pages: 1 ... 61 62 [63] 64 65 ... 110