Welcome! Log In Create A New Profile

Advanced

Error 2 (strlit)

Posted by Balage 
Error 2 (strlit)
November 15, 2015 03:42PM
Hello,

I have made an SPI communication,
But when I use more than 50 send the BVSERIAL send me Error 2 (strlit) message.
What can I do if I want to clear this.
Becasue I need more 100 byte send.
Best,

Balazs
Re: Error 2 (strlit)
November 15, 2015 05:38PM
More information required:
What device?
code example?
Re: Error 2 (strlit)
November 15, 2015 08:08PM
Hello,

The equipment is BV508-A

The code is tree is here

// Rookie 3
//SPI
// Lábak SPI
// RB14 : Clock
// RB13 : SDO
// RB8 : SDI
// RB0 : trigger

dim spi_adat,kuld
dim ack_lefuto,ack,i, kov

function fogadas()

io_pinRole(*RB5(),IN,WPU)
kov = 0
do // 133 byte fogadasa
ack = io_pinGet(*RB5())
if (ack = 0) && (ack <> ack_lefuto) then
spi_adat = spi_data(0xff)
kov = 1 // fogadas
// print(spi_adat)
ack_lefuto=ack
endif
if ack = 0 then
ack_lefuto = 1
endif
until kov = 1
return

endf

function kuldes(kuld)
io_pinRole(*RB5(),IN,WPU)
kov = 0
@SPI1CON = 0x18060
do
ack = io_pinGet(*RB5())
if (ack = 0) && (ack <> ack_lefuto) then
spi_data(0x(255-kuld)) // küldés
ack_lefuto=ack
kov = 1
endif
if ack = 0 then
ack_lefuto = 1
endif
until kov = 1
print kuld
return
endf

function Telegramkezdes()
dim SDI, SDITRIG
io_pinRole(*RB8(),IN,WPU)
SDITRIG = 0 // Várakozás, még az SDI TRIGGER 0
do
SDI = io_pinGet(*RB8())
if SDI = 0 then
io_pinSet(*RB13(),1)
for i = 1 to 720 // 634 us várakozás Data ágon
next
io_pinSet(*RB13(),0)
SDITRIG = 1
endif
until SDITRIG = 1
endf
// Telegrammok
// 133 kezdődő telegram
function telegram133()
kuldes(128)
kuldes(128)
kuldes(128)
kuldes(128)
kuldes(16)
kuldes(224)
kuldes(128)
kuldes(76)
kuldes(105)
kuldes(38)
kuldes(48)
kuldes(114)
kuldes(165)
kuldes(52)
kuldes(194)
kuldes(100)
kuldes(194)
kuldes(24)
@SPI1CON = 0x9060
print
endf

// 141 kezdődő telegram (kibontva)
function telegram141()
fogadas()
fogadas()
fogadas()
fogadas()
fogadas()
fogadas()
fogadas()
fogadas()
fogadas()
fogadas()
@SPI1CON = 0x9060

endf

// 69 kezdődő telegram

function telegram69()

// 1 byte
kuldes(192)
kuldes(176)
kuldes(94)
kuldes(53)
kuldes(57)
kuldes(209)
kuldes(1)
kuldes(238)
kuldes(54)
kuldes(6)
kuldes(234)
kuldes(114)
kuldes(112)
kuldes(225)
kuldes(213)
kuldes(185)
kuldes(177)
kuldes(1)
kuldes(46)
kuldes(150)
kuldes(250)
kuldes(106)
kuldes(50)
kuldes(48)
kuldes(78)
kuldes(57)
kuldes(41)
kuldes(145)
kuldes(1)
kuldes(30)
kuldes(142)
kuldes(150)
kuldes(70)
kuldes(218)
kuldes(208)
kuldes(246)
kuldes(57)
kuldes(41)
kuldes(209)
kuldes(1)
kuldes(238)
kuldes(142)
kuldes(230)
kuldes(70)
kuldes(58)
kuldes(104)

endf

// 5 kezdődő telegram

function telegram5()

// 1 byte
kuldes(200)
kuldes(64)
kuldes(165)
kuldes(32)
kuldes(0)
kuldes(127)
kuldes(134)
kuldes(252)
kuldes(12)
kuldes(136)
kuldes(64)
kuldes(80)
kuldes(104)
kuldes(0)
kuldes(0)
kuldes(0)
kuldes(0)
kuldes(0)
kuldes(0)
kuldes(0)
kuldes(0)
kuldes(3)
@SPI1CON = 0x9060


endf

function go()



// inicializálások
io_pinRole(*RB5(),IN,WPU)
io_pinRole(*RB6(),OUT,WOFF)
io_pinRole(*RB8(),IN,WPU)
io_pinRole(*RB13(),OUT,WOFF)
io_pinRole(*RB14(),OUT,WOFF)
ack_lefuto = 1
io_pinSet(*RB13(),0)
io_pinSet(*RB13(),1) // Digiview trigger
io_pinSet(*RB13(),0)

do // Várakozás, még a gép bekapcsol
ack = io_pinGet(*RB5())
until ack = 1


Telegramkezdes() // Data ág lent van 360 uS ig


spi_init(30800) //16 uS /16 uS
//Főprogram
//1 telegram
@SPI1CON = 0x9060
fogadas()
if spi_adat() = 133 then
telegram133()
endif
io_pinRole(*RB8(),IN,WPU)

Telegramkezdes()

// 2 telegram
@SPI1CON = 0x9060
fogadas()
if spi_adat() = 141 then
telegram141()
endif

io_pinRole(*RB8(),IN,WPU)

Telegramkezdes()

// 3 telegram
@SPI1CON = 0x9060
fogadas()
if spi_adat() = 69 then
telegram69()
endif
io_pinRole(*RB8(),IN,WPU)

Telegramkezdes()

// 4 telegram
// @SPI1CON = 0x9060
// fogadas()
// if spi_adat() = 5 then
// telegram5()
// endif

endf
Re: Error 2 (strlit)
November 16, 2015 12:37PM
Hello again,

I have made an other solution but there is fail too.
So i made the datablock with array, but there is not working yet.
I can not send more then 31 data byte.

data(45)
data(1) = 209
data(2) = 128
.
.
.


The second error message was error 2 (RB5)
RB5 is the acknoledge pin for the communication.
So I think this module can not use more then 31 byte cyclic data send.
:(
Best,
Balazs
Sorry, only registered users may post in this forum.

Click here to login