Show Posts
|
|
Pages: 1 2 [3] 4 5 ... 66
|
|
32
|
Using Arduino / Programming Questions / Re: Faking SPI with Attiny85
|
on: March 06, 2013, 08:07:50 am
|
|
The lines of code for USI aren't buying time so much as they are performing a function. To do SPI with the USI module you have to generate the clock cycles manually by writing to the config register - not only that but you have to manually do every edge, so for an 8bit transfer you have to perform 16 writes to the config register. If you just put 16 instructions in a line, you can get a clock rate of Fcpu/2, if you use a loop, that drops to Fcpu/6. You will have to edit USI.h to provide the correct Arduino pin numbers corresponding to the USI pin locations. There are three #defines at the top of the .h file which set this.
[USI library attached]
For the software library, you can use any of the 4 SPI modes, and have a choice over data order. Due to the way it is generated, the fastest speed I could get was 1/16th of the clock frequency. With the software library you have to specify which pins to use for SPI in the begin call: begin(byte SCK_, byte MOSI_, byte MISO_, byte SS_) There is also a function which allows you to set the state of the SS pin: void writeSS(boolean state);
[TinySoftwareSPI attached]
|
|
|
|
|
34
|
Using Arduino / Programming Questions / Re: how to increase the size of an array?
|
on: March 03, 2013, 07:34:16 pm
|
|
I was under the impression that the limit for avr-gcc was 32kB arrays (or 32k elements, whichever is smaller).
I just tried and had no problem compiling a program with an array of 8193 elements. I did try declaring the array as 8192 bytes and adding an extra and got the error message you reported. It looks like you have given too many initialisers as the error suggests (you specified more elements than fit in the array length you specified).
|
|
|
|
|
35
|
Using Arduino / Programming Questions / Re: error: invalid conversion from 'char' to 'const char*'
|
on: March 03, 2013, 07:09:48 pm
|
(1) @PaulS and @Grumpy_Mike... why not declare temperature as a char? Last time I checked, the temperature around here is unlikely to get above 127 degrees C or less than -128 degrees C. What on earth is the point in using an int when you don't need two bytes to store the value, you are just wasting a byte of precious RAM. Remeber folks, just because a char is called a char doesn't mean it has to be used to store a character! (Oh, and the temperature could be 'H', that would be room temperature if it were in fahrenheit: 72 degrees F is approx. 22 degrees C) (2) The issue lies in this line: ether.browseUrl(PSTR("/data_request?id=variableset&DeviceNum=49&serviceId=urn:upnp-org:serviceId:TemperatureSensor1&Variable=CurrentTemperature&Value="), temperature, website, my_callback); You first need to convert the temperature to a string of characters before passing it to that function. For example: char temp[5]; sprintf(temp,"%d",temperature); ether.browseUrl(PSTR("/data_request?id=variableset&DeviceNum=49&serviceId=urn:upnp-org:serviceId:TemperatureSensor1&Variable=CurrentTemperature&Value="), temp, website, my_callback);
|
|
|
|
|
36
|
Using Arduino / Microcontrollers / Re: More than 256K of memory?
|
on: February 16, 2013, 02:49:32 pm
|
|
Do you know it is going to be larger than 256K, or are you just making a wild guess? Just as an example, it is possible to make an entire MP3 player in 90k of Flash, and that was over 15000 lines of code...
|
|
|
|
|
39
|
Products / Arduino Due / Re: Due support for Nokia 6100 display
|
on: February 09, 2013, 05:38:58 am
|
|
The two types of display are completely different.
One is Colour, one is B/W. One uses 9bit SPI, the other uses 8bit SPI. All of the command registers have different addresses. I you were to write your own driver code, then you could possibly reuse alot of the code from my library.
|
|
|
|
|
40
|
Using Arduino / Microcontrollers / Re: Solution to PCREL error for avr25/ATTiny84/ATTiny85/ATTiny88.
|
on: February 05, 2013, 03:50:05 am
|
|
have you restarted the IDE?
Double check you put the ld file in this folder: "<arduino directory>\hardware\tools\avr\avr\bin"
Did you extract the ZIP file?
Did you definitely get the Windows version (not the Mac version by accident)?
This fix definitely applies to your problem, and should work.
@fungus, you don't need the whole folder, just the ld file.
|
|
|
|
|
41
|
Products / Arduino Due / Re: Due support for Nokia 6100 display
|
on: January 29, 2013, 03:50:22 pm
|
|
It is possible, but you would have to write the code to decode bitmaps youself.
I have done it in a previous project (displaying album art for an MP3 Player), but I never got around to cleaning up the code and posting it. Unfortunately I am rather busy with university work and won't have the time to be much help.
Bitmaps are fairly straight forward to decode. The issue is they store the pixel data in reverse (BGR with the first pixel data in the file being the last on the screen). I basically ended up having to use a large (2kB) ram array to extract and reverse the data chunk by chunk and print it to the display.
If you save the image as raw data in a PROGMEM array, then you can display it directly by calling:
graphic.Window(x1,y1,x2,y2);
to create a window on the screen, then fill it with pixels by calling:
twoPixels(red1,green1,blue1,red2,green2,blue2);
where the 6 values are 4 bits (0-F) and represent the red, green and blue data for two consecutive pixels.
|
|
|
|
|
42
|
Products / Arduino Due / Re: Due support for Nokia 6100 display
|
on: January 27, 2013, 03:35:33 pm
|
The simplest way to clear the extra letters is to have a set area of the screen that you are going to print the value to, say 4 characters in this case, then pad your string with ' ' (space) until those four letters have been written. For example: char x = 0; char y = 0;
graphic.setCoordinate(x,y); graphic.setFont(Normal_SolidBG); char numSent = graphic.print("123"); //prints the number 123. The print function returns how many letters have been written, so numSent=3 char oldX = x; x += (numSent*6); //for normal size font, each character is 6 pixels wide while(numSent < 4){ graphic.print(' '); //pad up to 4 characters. numSent++; x += 6; } x = oldX; //restore original print location.
|
|
|
|
|
43
|
Using Arduino / Programming Questions / Re: Help with bytes, ints, longs
|
on: January 26, 2013, 01:55:50 pm
|
The code you wrote can equally be written in another way, using a union: //Make a new variable type which contains an int, a long, and a 4 byte array all sharing the same memory space: typedef union { byte array[4]; long longInteger; int integer; } ArrayToInt;
ArrayToInt byteArray = {68,1,0,0}; //the first object in the union declaration is a 4 byte array, so the type can be initialised as an array. static char stringBuffer[50];
void setup(){ Serial.begin(9600); }
void loop(){ delay(1000); sprintf (stringBuffer, "Long, Int, Bytes: %ld, %i, %i %i %i %i --- ;) \r\n", byteArray.longInteger, byteArray.integer, byteArray.array[0], byteArray.array[1], byteArray.array[2], byteArray.array[3]); Serial.print(stringBuffer); Serial.println(); }
|
|
|
|
|
44
|
Using Arduino / Programming Questions / Re: Help with bytes, ints, longs
|
on: January 26, 2013, 11:47:14 am
|
|
Yup, AVRs use Little Endian, which means the following array:
{0,0,1,68}
when converted to a long becomes:
68*256^3 + 1*256^2 + 0*256^1 + 0*256^0 = 1140916224
Little endian means that the least significant byte is placed at the lowest memory address (leftmost in the array initialiser)
|
|
|
|
|
45
|
Using Arduino / Microcontrollers / Re: List of arduino compatible microcontrollers
|
on: January 26, 2013, 09:16:42 am
|
|
Further supported mega chips: Mega1280 Mega1284/644/324 Mega8 Mega88/168
Along with the Tiny chips you have listed, the following should work: Tiny87/167 [I'm about to add support to my tiny core for these as I will be using them in a project] Tiny861/461 Tiny88/48 Tiny24 Tiny25
|
|
|
|
|