Bin As Variable


Closed Thread
Results 1 to 2 of 2

Thread: Bin As Variable

  1. #1
    Join Date
    Jul 2004
    Location
    ISRAEL
    Posts
    6

    Default Bin As Variable

    if someone know if it possible to use with variable in bin command
    SEROUT2.........BIN16 VOLT
    I NEED
    SEROUT2.........BINx VOLT

    Eyal

  2. #2
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Hi Eyal,

    Can't do it the easy way, but this should do the trick.
    Code:
    ; ----[Send X number of binary digits]----------
    ASM
    SER_BINx  macro  Port, Pin, Mode, Value, X
    	SEROUT2DPIN?T	Port, Pin
    	SEROUT2MODE?C	Mode
    	SEROUT2PACE?C	000h
    	SEROUT2COUNT?B	X
    	SEROUT2NUM?W	Value
    	SEROUT2BIN?
        endm	
    ENDASM
    
    ; ----[Force PBP to include the macro's]---(doesn't use any code space)-----
    @ ifdef AddSEROUTcode
       SEROUT2  PORTB.0,396,[BIN16 R0, REP " "\R0.lowbyte] 
    @ endif
    ; ----------------------------------------------
    
    SOpin     VAR  PORTB.0
    Volt      VAR  WORD
    BINcount  VAR  BYTE
    
    Volt = 115
    
    FOR BINcount = 16 to 1 step -1
        @  SER_BINx  _SOpin, 396, _Volt, _BINcount
        SEROUT2 SOpin, 396,[13,10]    
    NEXT BINcount
    ; should send
    0000000001110011
    000000001110011
    00000001110011
    0000001110011
    000001110011
    00001110011
    0001110011
    001110011
    01110011
    1110011
    110011
    10011
    0011
    011
    11
    1
    Last edited by Darrel Taylor; - 30th September 2005 at 17:41.
    DT

Similar Threads

  1. EEPROM Variables (EE_Vars.pbp)
    By Darrel Taylor in forum Code Examples
    Replies: 79
    Last Post: - 26th October 2012, 00:06
  2. Variable PWM PIC18F2431
    By trr1985 in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 12th June 2009, 06:03
  3. Help with sound command in 2 programs
    By hyperboarder in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 5th July 2007, 20:36
  4. WORD vs BYTE variable lengths
    By bartman in forum General
    Replies: 0
    Last Post: - 28th November 2005, 21:16
  5. Let a variable change from bin to dec.
    By Roy in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 25th May 2004, 19:57

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