Show Posts
Pages: [1] 2 3 4
1  Using Arduino / General Electronics / Connector ID please on: October 17, 2012, 07:59:05 am
Hi, have tried searching but just dont know how its described! any idea what one of these is and where to get it?


kenwood_connector by daharro, on Flickr

it looks like a small version of the ATX power supply connector, 6x2.
Thanks
2  Using Arduino / Interfacing w/ Software on the Computer / Re: Forming a hex array to send on serial port on: October 09, 2012, 12:44:05 pm
that sucks, but never mind. i can work round it! Cheers for the help.
3  Using Arduino / Interfacing w/ Software on the Computer / Re: Forming a hex array to send on serial port on: October 09, 2012, 12:32:59 pm
That makes sense now. Also explains why i've seen *char every now and again.

Heres the solution i've got that seems to work now, although if anyone can tell me how to get away with not passing the length of the msgData array then feel free!

This calls the function:
Code:
byte msgDataArray[] = {0x04, 0x01, 0x99, 0xAA};
int msgDataSize = sizeof(msgDataArray);
sendMsg(0x44,0xBF,0x74, msgDataArray, msgDataSize);

The function itself:
Code:
void sendMsg(byte source, byte destination, byte msgType, byte *msgData, int msgLen) {

// 1 2 3 4 5 6 7
// [src] [len] [dest] [msgtype] [d0]...[dn] [crc]

//get length of msg data for len field
byte len = msgLen + 3;
//Set known data
byte GetData[255] = {source, len, destination, msgType};
for (int i = 0; i < msgLen; i++) {
int index = i+4;
GetData[index] = msgData[i];
}
//Location of ChkSum
int crcLoc = msgLen + 4;
//Set ChkSum
GetData[crcLoc] = getCheckSum(GetData);

//Print data to serial
for (int i = 0; i < len+2 ; i++)  {
Serial.print(GetData[i], HEX);
}
}

and the CRC function:
Code:
int getCheckSum(byte *string) {
int i;
int checksum;
int length;
checksum = 0;
length = string[1]+1;
//Serial.print("length: ");
//Serial.println(length);
for (i = 0; i < length; i++) {
checksum ^= string[i];
}
return checksum;
}

Many thanks to those that helped.
4  Using Arduino / Interfacing w/ Software on the Computer / Re: Forming a hex array to send on serial port on: October 09, 2012, 11:06:12 am
What is a "HEX array"?

Apologies, thought it was more obvious than it is. Its an array of hex bytes. It is formed in the way i showed in the OP, but where the message data bytes sit needs to be expandable and fed from another array of bytes.

You want the sendMsg() function to accept an array as the 4th argument? Then, define it that way:
Code:
void sendMsg(byte source, byte destination, byte msgType, byte msgData[someMaxSizeHere]) {
or
Code:
void sendMsg(byte source, byte destination, byte msgType, byte *msgData) {

Statically sizing GetData will be required. You'll need to define the array large enough to hold the largest message you plan to support. Copying the data from msgData to GetData is easy, using a for loop.

I was trying this but because i did not know the exact length it wouldnt accept the array being initialised as byte msgData[] which threw me. i have got the code to fill the array from a for loop, that came to me shortly after posting. Can you explain the concept of *msgData?

I'll try these solutions now and let you know. Thanks!
5  Using Arduino / Interfacing w/ Software on the Computer / Forming a hex array to send on serial port on: October 09, 2012, 06:54:14 am
Im trying to form a hex array with a variable number of data bits. I have a function which accepts the src, dest, message type and message data all in bytes and with single bytes everything works. I cant work out how to get it to accept an array of bytes for the message data as this can be anything from 1 to 20 bytes long. I will effectively end up with [SRC][LEN][DST][MSGTYPE][MSGDATA0]...[MSGDATA99][CRC]

So, how do i get it to accept this array within an array?!

Heres the code...

Code:
void sendMsg(byte source, byte destination, byte msgType, byte msgData) {

byte len = sizeof(msgData) + 3;

/* DEBUG
Serial.println("");
Serial.print("Src: ");
Serial.println(source, HEX);
Serial.print("Len: ");
Serial.println(len, HEX);
Serial.print("Dst: ");
Serial.println(destination, HEX);
Serial.print("Msg:");
Serial.println(msgType, HEX);
Serial.print("MsgData: ");
Serial.println(msgData, HEX);
*/

byte GetData[] = {source, len, destination, msgType, msgData, 0x00};
byte chkSum = getCheckSum(GetData);
int chkSumLocation = sizeof(GetData) -1;

/* DEBUG
Serial.print("chkLoc: ");
Serial.println(chkSumLocation);
*/

GetData[chkSumLocation] = chkSum;

for (int i = 0; i < sizeof(GetData); i++)  {
Serial.print(GetData[i], HEX);
}
//Serial.println("");
}

int getCheckSum(byte *string) {
int i;
int checksum;
int length;
checksum = 0;
length = string[1]+1;
//Serial.print("length: ");
//Serial.println(length);
for (i = 0; i < length; i++) {
checksum ^= string[i];
}
return checksum;
}

Also, while printing the packet out i am only getting one digit if the number printed is less than 10, for example instead of getting 04050610 i get 45610. any ideas?

Many thanks!
6  Using Arduino / Microcontrollers / Re: Attiny Breakout Board - TinyDuino on: December 11, 2011, 06:40:13 am
If enough people are interested I will layout a PTH board, but I intend to use this as an intro to SMD construction.
7  Using Arduino / Microcontrollers / Re: Attiny Breakout Board - TinyDuino on: December 10, 2011, 10:57:51 am
The Attiny4313, pin for pin compatible witht the 2313 has enough space for a bootloader, not sure if anyones tried it though, and also has a UART. The easiest way to use that will be with an FTDI connector as it'll require no more external parts.

8  Using Arduino / Microcontrollers / Re: Arduino Tiny on: December 08, 2011, 08:29:34 am
Hi

I have designed a breakout for the Attiny2313, Attiny85 and Attiny84. Please have a look here http://arduino.cc/forum/index.php/topic,82083.0.html for more info.

Hope it can be useful to some people.

Thanks
9  Using Arduino / Microcontrollers / Attiny Breakout Board - TinyDuino on: December 08, 2011, 08:26:09 am
Hi,

I've been working on a breakout board to support the tiny core found here: http://code.google.com/p/arduino-tiny/

This will allow you to use Attiny85, Attiny45 and Attiny2313 from one dev board which can easily be used with breadboard. So far this is an unproven design, so if anyone wants to test it feel free to make your own boards. I'll be having some made in the near future, january probably. I have yet to write the support documentation, so any questions please ask!

Source: http://dl.dropbox.com/u/8131315/MultiTinyDuino.rar


10  Using Arduino / Microcontrollers / Re: Arduino style board for AtTiny2313 on: September 19, 2011, 04:02:59 pm
You can probably have one instead of the switch, or i could put pads on the back and you can leave off the switch? Any thing else you want? I was thinking of putting inpads to disable/enable auto reset if ppl are going to use the bootloader?
11  Using Arduino / Microcontrollers / Re: Arduino style board for AtTiny2313 on: September 19, 2011, 01:42:17 pm
Probably not enough space for bootloader and a program of any use, but maybe a 4313 would have? I was actually just planning on having serial comms available mostly just for debugging so it wasnt an issue for me. The program is eagle-up, http://eagleup.wordpress.com/ which is an eagle ULP and a sketchup plugin. Really good!
12  Using Arduino / Microcontrollers / Arduino style board for AtTiny2313 on: September 18, 2011, 05:02:22 pm
Hi,

Im looking at throwing together some PCBs for an arduino style board using the AtTiny2313 MCU. Its pretty much a bare bones board but it might be useful to more people than just me. I havent finished the SCH or PCB files, but it'll give you an idea of what im aiming at.

I'll be looking to get a few PCBs made in the next few weeks, let me know if your interested and i'll get some to you for cost. Havent been priced up yet, but it wont be much more than 7/8 quid I would think.



Ta,

Dave
13  Forum 2005-2010 (read only) / Troubleshooting / Re: Serial Input in Windows 7 on: June 03, 2009, 01:37:24 pm
yep, tried that.
14  Forum 2005-2010 (read only) / Troubleshooting / Serial Input in Windows 7 on: June 03, 2009, 12:46:21 pm
Hi

Im trying to use Arduino-15 in windows 7 and it seems to work until i try and use the serial terminal in the IDE. It just kicks back random symbols. For instance the following code :

Quote

 
void setup() {
  Serial.begin(9600);
}

void loop() {
  Serial.println("A");
  delay(1000);
}

 

returns this :

Quote
@ó@ó8ó@ó<ó@ù@ó

I started using the luminet port and thought it might have been a problem with that but its happenign with the normal IDE too. Any Ideas?
15  Forum 2005-2010 (read only) / Syntax & Programs / Re: Firmata and VB on: February 20, 2009, 10:56:51 am
Im also interested in this, I have VB communicating with a board and values being transfered, but i would like to use this protocol or the simpler messaging protocol. I would be willing to share my code, can you do the same if you have found any solutions?

Thanks
Pages: [1] 2 3 4