problem wit command FILE
ingbaker
Posts: 10
Good morning
With respect to the propeller, I want to load binary data file
into memory, and then I display these datas on the serial terminal.
Here I use the command "FILE", my problem is that it only sends to the terminal from
3rd byte from the file.
This is the program that I use:
CON
_CLKMODE = XTAL1 + PLL16X
_XINFREQ = 5_000_000
OBJ
PANTALLA:"FullDuple xSerial"
VAR
BYTE DATAS
PUB GETDATA | INDEX
INDEX:=0
PANTALLA.START( 31, 30, 0, 57600)
WAITCNT((CLKFREQ* 3)+CNT)
REPEAT
DATAS:=BYTE[noparse][[/noparse] DTFILE][noparse][[/noparse]INDEX]
IF DATAS <> 0
PANTALLA.DEC( DATAS)
PANTALLA.STR( STRING(" "))
PANTALLA.TX( DATAS)
PANTALLA.STR( STRING(" "))
PANTALLA.DEC( INDEX)
PANTALLA.STR( STRING(" "))
PANTALLA.HEX( INDEX,2)
PANTALLA.STR( string(13) )
WAITCNT((CLKFREQ/ 4)+CNT)
++iNDEX
WHILE DATAS > 0
DAT
STR BYTE "Esto es un mensaje",0
DTFILE FILE "DATAFILE.bin"
Now if my DATAFILE.bin has:”12345678….”
With index=0, My program reads 345678… and this losts 1 and 2
But when I replace
DATAS:=BYTE[noparse][[/noparse] DTFILE][noparse][[/noparse]INDEX]
by
DATAS:=BYTE[noparse][[/noparse] DTFILE][noparse][[/noparse]INDEX- 2]
I read from the 1st byte of the file:
With index =0 this is reads 12345678.. and can read all file
Please what happen?
Baker Carpio
With respect to the propeller, I want to load binary data file
into memory, and then I display these datas on the serial terminal.
Here I use the command "FILE", my problem is that it only sends to the terminal from
3rd byte from the file.
This is the program that I use:
CON
_CLKMODE = XTAL1 + PLL16X
_XINFREQ = 5_000_000
OBJ
PANTALLA:"FullDuple xSerial"
VAR
BYTE DATAS
PUB GETDATA | INDEX
INDEX:=0
PANTALLA.START( 31, 30, 0, 57600)
WAITCNT((CLKFREQ* 3)+CNT)
REPEAT
DATAS:=BYTE[noparse][[/noparse] DTFILE][noparse][[/noparse]INDEX]
IF DATAS <> 0
PANTALLA.DEC( DATAS)
PANTALLA.STR( STRING(" "))
PANTALLA.TX( DATAS)
PANTALLA.STR( STRING(" "))
PANTALLA.DEC( INDEX)
PANTALLA.STR( STRING(" "))
PANTALLA.HEX( INDEX,2)
PANTALLA.STR( string(13) )
WAITCNT((CLKFREQ/ 4)+CNT)
++iNDEX
WHILE DATAS > 0
DAT
STR BYTE "Esto es un mensaje",0
DTFILE FILE "DATAFILE.bin"
Now if my DATAFILE.bin has:”12345678….”
With index=0, My program reads 345678… and this losts 1 and 2
But when I replace
DATAS:=BYTE[noparse][[/noparse] DTFILE][noparse][[/noparse]INDEX]
by
DATAS:=BYTE[noparse][[/noparse] DTFILE][noparse][[/noparse]INDEX- 2]
I read from the 1st byte of the file:
With index =0 this is reads 12345678.. and can read all file
Please what happen?
Baker Carpio
Comments
datas := byte[noparse][[/noparse]@DFILE][noparse][[/noparse]index]
btw: Use the [noparse][[/noparse] code ] and [noparse][[/noparse] /code ] (without spaces) to format your code so it is more legible.
From your program I assume you speak spanish... Bienvenido aunque ya hayas escrito 5 veces
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Visit some of my articles at Propeller Wiki:
MATH on the propeller propeller.wikispaces.com/MATH
pPropQL: propeller.wikispaces.com/pPropQL
pPropQL020: propeller.wikispaces.com/pPropQL020
OMU for the pPropQL/020 propeller.wikispaces.com/OMU
Esta noche probare tu consejo.
Saludos
datas := DTFILE[noparse][[/noparse]index]
Arriba