conversion from picbasic to picbasic pro


Closed Thread
Results 1 to 3 of 3
  1. #1
    Join Date
    Sep 2011
    Posts
    2

    Default conversion from picbasic to picbasic pro

    Hello,

    i was wondering if somone could help me with this code:
    Code:
    OntvangBitAantal:             ;Vul het ontvangstbyte met het opgegeven aantal bits in BCD mode    
        OntvangByte = 0
        FOR BD1 = 0 TO BitAantal - 1
            GOSUB OntvangEenBit
            'IF OntvangBit = 1 THEN  SETBIT OntvangByte,BD1
            IF OntvangBit = 1 THEN  OntvangByte,0(BD1)=1
            endif
        NEXT
        OntvangByte = ((OntvangByte >> 4) * 10) + (OntvangByte & 15) ;BCD (Binary-Coded Decimal) naar byte conversie
        RETURN
    
    
        OntvangEenBit:                ;Ontvang een bit en bewaar dit in OntvangBit
        
        WHILE DCF_Signaal = 0          
        wend
        ontvangbit=bitwaarde
        dcf_signaal = 0
        return
    the problem is this line:
    Code:
    'IF OntvangBit = 1 THEN  SETBIT OntvangByte,BD1
    it is for picbasic and not picbasic pro
    what function do i need in picbasic pro
    include "bs1defs.bas" i allready done

    note this is a routine for putting bits in a byte that are recieved from an antenna, one bit every second

    all help is welcome

  2. #2
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,518


    Did you find this post helpful? Yes | No

    Default Re: conversion from picbasic to picbasic pro

    Hi,
    If OntvangByte is a byte (or word or long) you access its indivudal bits using the dot notation, like:
    Code:
    OntvangenByte.0 = 1  'Set bit 0
    OntvangenByte.7 = 0  'Set bit 7
    
    If Ontvangbit = 1 THEN   ' If bit is set
      OntvangByte.0 = 1       ' Set lowest significant bit in BYTE
    ENDIF
    /Henrik.

  3. #3
    Join Date
    Sep 2011
    Posts
    2


    Did you find this post helpful? Yes | No

    Default Re: conversion from picbasic to picbasic pro

    Henrik,

    many Thanks

    Problem solved ! i used the , instead of the .

    IF OntvangBit = 1 THEN OntvangByte.0(bd1)=1
    thanks again

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts