PDA

Click to See Complete Forum and Search --> : Binary data via serial link


julytoccr
Jan 7th, 2002, 03:01 PM
I need to transmit a .jpg file via a serial link at 9600 bps
i use this code to transmit it

.....................
While ((tamanio_buffer_transmisor <= 511) And (byteleido < tamaniofoto))

byteleido = byteleido + 1
Get #1, byteleido, FileData
ByteArray(tamanio_buffer_transmisor) = FileData
tamanio_buffer_transmisor = tamanio_buffer_transmisor + 1
Wend

texto_transmitir = ByteArray
puertoserial.Output = texto_transmitir
.....



How can i do for .jpg files ?
This work fine for text file , but when i try a jpg file i dont recieve all bytes , you know why ? i mean , i recieve the data and when i try to save it to a file , the resultant file miss some bytes from the original files . the InputMode on reciever are binary or text ?
it is a reciever or transmisor problem ?




Thank u in advance
Julian

jim mcnamara
Jan 7th, 2002, 03:47 PM
Try opening he input file as binary:

open "myfile.jpg" for binary as #1
Dim myByte as byte
Do while not Eof(1)
get#1,,myByte
' send the byte
Loop

julytoccr
Jan 8th, 2002, 07:54 AM
I do have the .jpg file opened in binary format already ,
and i sent it as a byte array

how can i read in the reciever , binary data ?
because a do


........
If RXCommT.InBufferCount Then

'saved to some strings variable
CommBufferT$ = RXCommT.Input
BufferT = BufferT + CommBufferT$

'Procces it and save it to a .jpg binary file
'..........

end if
.......


but it is a transmiter or reciever problem ?
Thanks u.
Julian