We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hi, can anyone tell me how i would set up a variable that expects a certain amount of data to be received through rs232.
i.e. to receive 18 bytes of data only once the the rx pin has been set to input.
thanks guys
"i will receive a string of 144 bits"
If you're going to use the UART, it has to be sent as 18 bytes - each one complete with start & stop bits.
Is that the case?
Yes as 18 bytes, this is the case, I am now at the point where i have set-up a counter which just incriments the ascii table to send unspecified characters wirelessly.... but its the initial receiving of the bytes at the transmission side i am unsure of with regards as to how do i set-up a function to receive the 18 bytes...as i am currently using getchar to receive each byte. hope im clear.
hope im clear
you are not
WHY do you wnat to receive just 18 bytes, not everything the unit send to you?
Erik
Well technically i do, but the unit will only send me 18 bytes every minute. which will contain all the weather data, i do not need to know what the data is, just that there is 18 bytes of raw data.
so, are you saying that all your unit has to do is to receive characters/bytes and resend them?
what is the baudrate in and out?
Yes that is basically all i hacve to do, although i will need to write the bytes to eeprom for storage as a backup if the sending fails which if it does then they can be resent. the baud rate is 9600.
you have all the processing time you need to run this simple task at 9600, so 1) write the code 2) debug it 3) smile
I would totally forget all about using library functions, let the sensor write to a circular buffer, upon receiving characters wait for previous byte tranamit complete (TI should be almost immediate) and transmit the char. Let main take care of storing from the circular buffer to the EEPROM.
NOTE: if you bit-bang the EEPROM you WILL "have a lot of fun" doing this, select a derivative that can drive the EEPRROM (IIC, SPI or whatever) through hardware.
Hi well this is the code i have atm for the transmitter:
void TRANSMITTER(void) { unsigned char Mode; unsigned char b; unsigned char Packet; unsigned int address; if (Mode == 'd') { Packet = GetChar(); Configuration(); DELAY_100us(200); for(b=0;b<txconf.n;b++) { SPI_ReadWrite(txconf.buf[b]); } Standby(); DELAY_100us(200); for (address=0x00;address<0xff;address++) { EEWrite(address,Packet); } for (Packet=0;Packet<18;Packet++) { TRANSMIT_Packet(Packet); } } }
if (Mode == 'd') is just for the pulse pin i have set up to ensure the data to be received is data and not a command as can be seen i have set up an unsigned char Packet and i am using Packet = GetChar(); to retreive the byte.....if i remove the GetChar() how can i assign the byte received to Packet to ensure that byte is sent, further down the code?
Cheers Rhys
can someone please analyse this code? thanks
can someone please analyse this code
HOW?
what does packet() do ? what does configuration() do: ? why do you indent 'a mile' use spaces, not table?
PS: you have two options a) wait till it may be convenient for a responder if you want it for free OR b) pay for it.
Do you really think there are people sitting around just waiting to solce your problem for free?
Are you and martyn kay working on the same project or are you the same person?
http://www.keil.com/forum/docs/thread9637.asp
"can someone please analyse this code?"
For a start, you need to fix the layout (indentation) - it's all over the place!
Use spaces - do not use TABs.
You know where you are with spaces, but the interpretation of TABs is entirely at the whim of the displaying application and/or device and its/their particular configuration(s)!
And use the 'Preview' before posting to verify that it's OK.
Well as you seem to respond to most posts i am presuming you are forum moderators employed by keil?? if not then i am truly greatful for your help. the configuration() etc just set up the nrf24e1 CS and CE, and in response to Dan, we are not the same person but are working on the same project......im not that immature.