Page 1 of 1

Funzione: storebit error

PostPosted: 06 Apr 2014, 18:56
by suibaf
Per cercare di mettere ordine al codice ho fatto una funzione.Prima l'ho dichiarata con :

Code: Select all
Declare Function Ceck_presenza_card(ar() As Byte) As Bit


e l'ho messa in fondo a tutto il codice.

Dove mi serviva l'ho richiamata con:
Code: Select all
Dim Presenza_card As Bit

Presenza_card = Ceck_presenza_card(rcv_buff()) 



Ma proprio qui va in errore con storebit error. Cosa vorrà mai questa volta l'adorato Bascom AVR.
Vi ringrazio in anticipo.

Code: Select all
Function Ceck_presenza_card(ar() As Byte) As Bit

   'Ar() è formato da sette byte
   'DE 3C ED 00 21 00 35 carta presente
   'EC 08 CE 00 00 00 31 carta Assente

   If Ar(1) = &HDE And Ar(2) = &H3C And Ar(3) = &HED And Ar(4) = &H00 And Ar(5) = &H21 And Ar(6) = &H00 And Ar(7) = &H35 Then

      Ceck_presenza_card = 1

   Else

      Ceck_presenza_card = 0

   End If

End Function


Re: Funzione: storebit error

PostPosted: 06 Apr 2014, 20:53
by deluca
L'adorato Bascom-AVR ti dice che non puoi assegnare il valore di una funzione(che non può restituire un boolean) ad una variabile di tipo Bit.

storebit .... molto semplice :)

Re: Funzione: storebit error

PostPosted: 07 Apr 2014, 08:41
by suibaf
Grazie mille Giovanni!