Funzione: storebit error

Sezione dedicata al sistema di sviluppo BASCOM-AVR per i micro AVR
At90s, Attiny, Atmega e Xmega

Funzione: storebit error

Postby suibaf » 06 Apr 2014, 18:56

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

User avatar
suibaf
 
Posts: 122
Joined: 08 Mar 2014, 09:55
Location: Lecce

Re: Funzione: storebit error

Postby deluca » 06 Apr 2014, 20:53

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 :)
Ciao
Il mio sito: http://www.delucagiovanni.com ......e la chat: chat/
User avatar
deluca
Site Admin
 
Posts: 1104
Joined: 19 Jun 2011, 10:44
Location: 95123 - Catania (Italy)

Re: Funzione: storebit error

Postby suibaf » 07 Apr 2014, 08:41

Grazie mille Giovanni!
User avatar
suibaf
 
Posts: 122
Joined: 08 Mar 2014, 09:55
Location: Lecce


Return to BASCOM-AVR

Who is online

Users browsing this forum: No registered users and 1 guest

cron