Need to drive 40 pins on variable change, is there a way to do it in elegant way? - Page 2
+ Reply to Thread
Page 2 of 2 FirstFirst 12
Results 41 to 71 of 71
  1. #41
    Join Date
    Feb 2013
    Posts
    427

    Default Re: Need to drive 40 pins on variable change, is there a way to do it in elegant way?

    Haha, just noted that, thanks!
    Good I have PIC16F887, which is pin compatible but has EEPROM, will move to it...

  2. #42
    Join Date
    Feb 2013
    Posts
    427

    Default Re: Need to drive 40 pins on variable change, is there a way to do it in elegant way?

    Continuing with code development, now adding adjust time option, but run into issue. Data to RTC should be written into HEX format, but when I write rtctime=$timevariable it gives syntax error, what should I do?

  3. #43
    Join Date
    Jan 2006
    Location
    Istanbul
    Posts
    1,188

    Default Re: Need to drive 40 pins on variable change, is there a way to do it in elegant way?

    Quote Originally Posted by CuriousOne View Post
    Continuing with code development, now adding adjust time option, but run into issue. Data to RTC should be written into HEX format, but when I write rtctime=$timevariable it gives syntax error, what should I do?
    I posted a reply for this in your other post:
    http://www.picbasic.co.uk/forum/showthread.php?t=24078
    "If the Earth were a single state, Istanbul would be its capital." Napoleon Bonaparte

  4. #44
    Join Date
    May 2013
    Location
    australia
    Posts
    1,583

    Default Re: Need to drive 40 pins on variable change, is there a way to do it in elegant way?

    why would you use an obsolete difficult to use poor time keeping rtc like a ds1302 for a new project you hope to publish ?

    a DS3231 is cheap easier to use and soooo much better at keeping time ,has alarm function too . the cheap modules even have a backup battery holder fitted and a 32k eeprom thay are about $1 us on ebay
    the error the DS3231's i'm using is < 2sec / month [and you can trim the tcxo if necessary] , the ds1302 error is minutes / week with those nasty cheap xtals that abound
    This is more entertaining than Free to Air TV

  5. #45
    Join Date
    Feb 2013
    Posts
    427

    Default Re: Need to drive 40 pins on variable change, is there a way to do it in elegant way?

    Thanks, I've checked it. This is it?

    convertion:

    RTC=decx DIG 1
    RTC=RTC<<4
    RTC=RTC+decx DIG 0
    return

  6. #46
    Join Date
    Feb 2013
    Posts
    427

    Default Re: Need to drive 40 pins on variable change, is there a way to do it in elegant way?

    My programming skills are quite limited, and I'm more looking at result - having working nixie clock in this case, rather than improving my programming skills. I will post source code also, so if anyone has will, he then can adapt it to different RTC.

  7. #47
    Join Date
    Feb 2013
    Posts
    427

    Default Re: Need to drive 40 pins on variable change, is there a way to do it in elegant way?

    Thanks everyone who helped, here's completed and working code.

    On startup, it displays alternating 1-2. If you press button during that display, you enter config mode. Press button to set year, month, day, hour, minute. to advance to next setting, just don't press button and wait till middle dot blinks. In "main" mode, pressing button will cycle thru year/day/month/time.

    Code is made for 16F1519, but can be used on almost any PIC which has at least 30 output capable pins. No EEPROM is needed, compiled code is about 2.3k, and as I can guess, it can be further reduced in size. I'm by no means programming guru when I learned programming, 16K ram was common and 64K was considered luxury and 1MB was used only on supercomputers

    Code:
    ;----[16F1519 Hardware Configuration]-------------------------------------------
    #IF __PROCESSOR__ = "16F1519"
      #DEFINE MCU_FOUND 1
    #CONFIG
    cfg1 = _FOSC_INTOSC           ; INTOSC oscillator: I/O function on CLKIN pin
    cfg1&= _WDTE_OFF              ; WDT disabled
    cfg1&= _PWRTE_OFF             ; PWRT disabled
    cfg1&= _MCLRE_OFF              ; MCLR/VPP pin function is MCLR
    cfg1&= _CP_OFF                ; Program memory code protection is disabled
    cfg1&= _BOREN_OFF             ; Brown-out Reset disabled
    cfg1&= _CLKOUTEN_OFF          ; CLKOUT function is disabled. I/O or oscillator function on the CLKOUT pin
    cfg1&= _IESO_OFF              ; Internal/External Switchover mode is disabled
    cfg1&= _FCMEN_OFF             ; Fail-Safe Clock Monitor is disabled
      __CONFIG _CONFIG1, cfg1
    
    cfg2 = _WRT_OFF               ; Write protection off
    cfg2&= _VCAPEN_OFF            ; VCAP pin function disabled
    cfg2&= _STVREN_ON             ; Stack Overflow or Underflow will cause a Reset
    cfg2&= _BORV_LO               ; Brown-out Reset Voltage (Vbor), low trip point selected.
    cfg2&= _LPBOR_OFF             ; Low-Power BOR is disabled
    cfg2&= _LVP_OFF               ; High-voltage on MCLR/VPP must be used for programming
      __CONFIG _CONFIG2, cfg2
    
    #ENDCONFIG
    
    #ENDIF
    
    ;----[Verify Configs have been specified for Selected Processor]----------------
    ;       Note: Only include this routine once, after all #CONFIG blocks
    #IFNDEF MCU_FOUND
      #ERROR "No CONFIGs found for [" + __PROCESSOR__ +"]"
    #ENDIF
    
    'nixie led clock electronics direct drive
    
    include "modedefs.bas"
    OSCCON = %01111010  'SET INTOSC TO 16MHZ
    ANSELC=%00000000
    ANSELD=%00000000 'disable ADC
    ANSELB=%00000000
    ANSELA=%00000000
    ANSELE=%00000000
    
    TRISC=%00000000 'set PORTC as output all
    TRISD=%00000000 'set PORTD as output all
    TRISB=%00000000 'set PORTD as output all
    TRISA=%00111000
    TRISE=%00000000
    
    DEFINE OSC 16   'OSC SPEED
    
    'PIN CONFIG
    
    FEXI var PORTE.3 'button 
    
    'TENS HOURS PINS
    
    A0 VAR PORTD.7
    A1 VAR PORTD.6
    A2 VAR PORTD.5
    
    'ONES HOURS PINS
    
    B0 VAR PORTB.2
    B1 VAR PORTB.3
    B2 VAR PORTB.5
    B3 VAR PORTB.4
    B4 VAR PORTD.4
    B5 VAR PORTA.0
    B6 VAR PORTA.1
    B7 VAR PORTA.2
    B8 VAR PORTE.0
    B9 VAR PORTB.1
    
    'BLINKING DOT
    
    DOT VAR PORTE.1
    
    'TENS OF MINUTES
    
    C0 VAR PORTC.7
    C1 VAR PORTB.0
    C2 VAR PORTE.2
    C3 VAR PORTA.7
    C4 VAR PORTC.0
    C5 VAR PORTC.1
    
    'ONES OF MINUTES
    
    D0 var PORTD.3
    D1 VAR PORTC.4
    D2 VAR PORTC.5
    D3 VAR PORTC.6
    D4 VAR PORTC.2
    D5 VAR PORTC.3
    D6 VAR PORTD.0
    D7 var PORTD.1
    D8 VAR PORTA.6
    D9 var PORTD.2 
    
    'DS 1302 pins
    
    RST  Var PORTA.5
    IO   Var PORTA.4
    SCLK Var PORTA.3
    
    ' DS1302 Allocate variables
    rtcyear    Var byte
    rtcday     Var byte
    rtcmonth   Var byte
    rtcdate    Var byte
    rtchr      Var byte
    rtcmin     Var byte
    rtcsec     Var byte
    rtccontrol Var byte  
    
    'my time variables
    
    saatebi var word   'hours
    cutebi var word    'minutes
    clebi var word     'years
    tve var word       'months
    dge var word        'days
    DRO var byte       'temp time holder
    cvladi var word
    cvladi=0
    
    
    X VAR WORD ' TEMP VARIABLE refresh time
    X=1
    
    Y var word 'temp variable 2
    y=1
    
    Z var word 'temp variable 3
    Z=1
    
    
    cvlileba var byte 'detect time change
    
    T1 VAR WORD 'VARIABLES FOR TIME DIGITS
    T2 VAR WORD
    T3 VAR WORD
    T4 VAR WORD
    
    Low RST         ' Reset RTC
    Low SCLK
    
    'init stage wait for userpress for config
    PAUSE 1000
    
    'read RTC values into variables
    gosub gettime
    gosub timedecode
    saatebi=t1*10+t2 'read hours
    cutebi=T3*10+T4 ' read minutes
    gosub yeardecode
    clebi=T3*10+T4
    gosub monthdaydecode
    tve=T1*10+T2 ' get month
    dge=T3*10+T4 'get day
    
    FOR Z=1 TO 10  'DO SOME startup ANIMATION
    IF FEXI=0 THEN GOTO DADGENA
    T1=1
    T2=1
    T3=1
    T4=1
    GOSUB DISPLAY
    PAUSE 200
    T1=2
    T2=2
    T3=2
    T4=2
    GOSUB DISPLAY
    PAUSE 200
    NEXT Z
    
    goto demoscene
    
    
    DADGENA: 'enter setup mode and set year
    IF fexi=0 THEN
    Y=Y+1
    ELSE
    Y=0
    Z=Z+1
    ENDIF
    PAUSE 1
    IF Y=100 THEN
    clebi=clebi+1
    if clebi>38 then clebi=1
    	rtcyear=clebi DIG 1
    	rtcyear=rtcyear<<4
    	rtcyear=rtcyear+clebi DIG 0
    gosub settime
    gosub gettime
    gosub yeardecode
    gosub display
    pause 100
    Z=0
    ENDIF
    IF Z=3000 THEN
    Z=0
    high dot
    pause 100
    low dot
    pause 100
    high dot
    pause 100
    low dot
    pause 100
    gosub monthdaydecode
    gosub display
    
    GOTO dadgena2
    endif
    goto DADGENA 'exit from loop
    
    DADGENA2: 'enter setup mode and set month
    high dot
    IF fexi=0 THEN
    Y=Y+1
    ELSE
    Y=0
    Z=Z+1
    ENDIF
    PAUSE 1
    IF Y=100 THEN
    tve=tve+1
    if tve>12 then tve=1
    	rtcmonth=tve DIG 1
    	rtcmonth=rtcmonth<<4
    	rtcmonth=rtcmonth+tve DIG 0
    gosub settime
    gosub gettime
    gosub monthdaydecode
    gosub display
    pause 100
    Z=0
    ENDIF
    IF Z=3000 THEN
    Z=0
    high dot
    pause 100
    low dot
    pause 100
    high dot
    pause 100
    low dot
    pause 100
    GOTO dadgena3
    endif
    goto DADGENA2 'exit from loop
    
    DADGENA3: 'enter setup mode and set day
    high dot
    IF fexi=0 THEN
    Y=Y+1
    ELSE
    Y=0
    Z=Z+1
    ENDIF
    PAUSE 1
    IF Y=100 THEN
    dge=dge+1
    if dge>31 then dge=1
    	rtcdate=dge DIG 1
    	rtcdate=rtcdate<<4
    	rtcdate=rtcdate+dge DIG 0
    gosub settime
    gosub gettime
    gosub monthdaydecode
    gosub display
    pause 100
    Z=0
    ENDIF
    IF Z=3000 THEN
    Z=0
    high dot
    pause 100
    low dot
    pause 100
    high dot
    pause 100
    low dot
    pause 100
    gosub gettime
    gosub timedecode
    gosub display
    GOTO DADGENA4
    endif
    goto DADGENA3 'exit from loop
    
    DADGENA4: 'enter setup mode and set hour
    high dot
    IF fexi=0 THEN
    Y=Y+1
    ELSE
    Y=0
    Z=Z+1
    ENDIF
    PAUSE 1
    IF Y=100 THEN
    saatebi=saatebi+1
    if saatebi>23 then saatebi=0
    	rtchr=saatebi DIG 1
    	rtchr=rtchr<<4
    	rtchr=rtchr+saatebi DIG 0
    gosub settime
    gosub gettime
    gosub timedecode
    gosub display
    pause 100
    Z=0
    ENDIF
    IF Z=3000 THEN
    Z=0
    high dot
    pause 100
    low dot
    pause 100
    high dot
    pause 100
    low dot
    pause 100
    gosub gettime
    gosub timedecode
    gosub display
    GOTO DADGENA5
    endif
    goto DADGENA4 'exit from loop
    
    DADGENA5: 'enter setup mode and set hour
    high dot
    IF fexi=0 THEN
    Y=Y+1
    ELSE
    Y=0
    Z=Z+1
    ENDIF
    PAUSE 1
    IF Y=100 THEN
    cutebi=cutebi+1
    if cutebi>59 then cutebi=0
    	rtcmin=cutebi DIG 1
    	rtcmin=rtcmin<<4
    	rtcmin=rtcmin+cutebi DIG 0
    gosub settime
    gosub gettime
    gosub timedecode
    gosub display
    pause 100
    Z=0
    ENDIF
    IF Z=3000 THEN
    Z=0
    high dot
    pause 100
    low dot
    pause 100
    high dot
    pause 100
    low dot
    pause 100
    GOTO demoscene
    endif
    goto DADGENA5 'exit from loop
    
    DEMOSCENE:
    gosub gettime
    gosub timedecode
    if cvlileba=1 then gosub segtest 
    gosub display
    FOR Y=1 TO 1001
    PAUSE 1
    HIGH DOT
    IF FEXI=0 THEN GOSUB TDM
    NEXT Y
    
    FOR y=1 TO 1001
    PAUSE 1
    LOW DOT
    IF FEXI=0 THEN GOSUB TDM
    NEXT y
    GOTO DEMOSCENE
    
    TDM:
    GOSUB YEARDECODE
    GOSUB DISPLAY
    LOW DOT
    PAUSE 1000
    GOSUB MONTHDAYDECODE
    GOSUB DISPLAY
    HIGH DOT
    PAUSE 1000
    LOW DOT
    GOSUB GETTIME
    GOSUB TIMEDECODE
    GOSUB DISPLAY
    RETURN 
    
    ' Subroutine to write time to RTC
    settime:
    
    
       RST = 1         ' Ready for transfer
    
       ' Enable write
       Shiftout IO, SCLK, LSBFIRST, [$8e, 0]
       RST = 0         ' Reset RTC
       RST = 1         ' Ready for transfer
      ' high dot
       ' Write all 8 RTC registers in burst mode
       Shiftout IO, SCLK, LSBFIRST, [$be, rtcsec, rtcmin, rtchr, rtcdate, rtcmonth, rtcday, rtcyear, 0]
       RST = 0         ' Reset RTC
       pause 100
      ' low dot
      
    
       Return
       
    ' Subroutine to read time from RTC
    gettime:
       RST = 1         ' Ready for transfer
       Shiftout IO, SCLK, LSBFIRST, [$bf] ' Read all 8 RTC registers in burst mode
       Shiftin IO, SCLK, LSBPRE, [rtcsec, rtcmin, rtchr, rtcdate, rtcmonth, rtcday, rtcyear, rtccontrol]
       RST = 0         ' Reset RTC
       
       if DRO<>rtcmin then
       cvlileba=1
       else
       cvlileba=0
       endif 
     
     DRO=rtcmin 
       Return   
    
    timedecode:
       t1=rtchr >> 4 
       t2=rtchr // 16 
       T3=rtcmin >> 4 
       T4=rtcmin // 16
    return
    
    yeardecode:
       t1=2 
       t2=0 
       T3=rtcyear >> 4 
       T4=rtcyear // 16
    return   
    
    monthdaydecode:
       t1=rtcmonth >> 4 
       t2=rtcmonth // 16 
       T3=rtcdate >> 4 
       T4=rtcdate // 16
       return
    
    
    
    :SEGTEST  'test all segments
    x=20
    HIGH A0
    PAUSE X
    HIGH A1
    PAUSE X
    HIGH A2
    PAUSE X
    HIGH B0
    PAUSE X
    HIGH B1
    PAUSE X
    HIGH B2
    PAUSE X
    HIGH B3
    PAUSE X
    HIGH B4
    PAUSE X
    HIGH B5
    PAUSE X
    HIGH B6
    PAUSE X
    HIGH B7
    PAUSE X
    HIGH B8
    PAUSE X
    HIGH B9
    PAUSE X
    HIGH C0
    PAUSE X
    HIGH C1
    PAUSE X
    HIGH C2
    PAUSE X
    HIGH C3
    PAUSE X
    high c4
    pause x
    high c5
    pause x
    high d0
    pause x
    high d1
    pause x
    high d2
    pause x
    high d3
    pause x
    high d4
    pause x
    high d5
    pause x
    high d6
    pause x
    high d7
    pause x
    high d8
    pause x
    high d9
    pause x
    high dot
    pause x
    
    RETURN
    
    DISPLAY: 'DECODE VALUES AND DISPLAY THEM
    
    'tens hours
    
    IF T1=0 THEN
    HIGH A0
    ELSE
    LOW A0
    ENDIF
    
    IF T1=1 THEN
    HIGH A1
    ELSE
    LOW A1
    ENDIF
    
    IF T1=2 THEN
    HIGH A2
    ELSE
    LOW A2
    ENDIF
    
    'ONES HOURS
    
    IF T2=0 THEN
    HIGH B0
    ELSE
    LOW B0
    ENDIF
    
    IF T2=1 THEN
    HIGH B1
    ELSE
    LOW B1
    ENDIF
    
    IF T2=2 THEN
    HIGH B2
    ELSE
    LOW B2
    ENDIF
    
    IF T2=3 THEN
    HIGH B3
    ELSE
    LOW B3
    ENDIF
    
    IF T2=4 THEN
    HIGH B4
    ELSE
    LOW B4
    ENDIF
    
    IF T2=5 THEN
    HIGH B5
    ELSE
    LOW B5
    ENDIF
    
    IF T2=6 THEN
    HIGH B6
    ELSE
    LOW B6
    ENDIF
    
    IF T2=7 THEN
    HIGH B7
    ELSE
    LOW B7
    ENDIF
    
    IF T2=8 THEN
    HIGH B8
    ELSE
    LOW B8
    ENDIF
    
    IF T2=9 THEN
    HIGH B9
    ELSE
    LOW B9
    ENDIF
    
    'tens of minutes
    
    IF T3=0 THEN
    HIGH C0
    ELSE
    LOW C0
    ENDIF
    
    IF T3=1 THEN
    HIGH C1
    ELSE
    LOW C1
    ENDIF
    
    IF T3=2 THEN
    HIGH C2
    ELSE
    LOW C2
    ENDIF
    
    IF T3=3 THEN
    HIGH C3
    ELSE
    LOW C3
    ENDIF
    
    IF T3=4 THEN
    HIGH C4
    ELSE
    LOW C4
    ENDIF
    
    IF T3=5 THEN
    HIGH C5
    ELSE
    LOW C5
    ENDIF
    
    'ONES OF MINUTES
    
    IF T4=0 THEN
    HIGH D0
    ELSE
    LOW D0
    ENDIF
    
    IF T4=1 THEN
    HIGH D1
    ELSE
    LOW D1
    ENDIF
    
    IF T4=2 THEN
    HIGH D2
    ELSE
    LOW D2
    ENDIF
    
    IF T4=3 THEN
    HIGH D3
    ELSE
    LOW D3
    ENDIF
    
    IF T4=4 THEN
    HIGH D4
    ELSE
    LOW D4
    ENDIF
    
    IF T4=5 THEN
    HIGH D5
    ELSE
    LOW D5
    ENDIF
    
    IF T4=6 THEN
    HIGH D6
    ELSE
    LOW D6
    ENDIF
    
    IF T4=7 THEN
    HIGH D7
    ELSE
    LOW D7
    ENDIF
    
    IF T4=8 THEN
    HIGH D8
    ELSE
    LOW D8
    ENDIF
    
    IF T4=9 THEN
    HIGH D9
    ELSE
    LOW D9
    ENDIF
          'ended
    return

  8. #48
    Join Date
    Feb 2013
    Posts
    427

    Default Re: Need to drive 40 pins on variable change, is there a way to do it in elegant way?

    Oh and by the way, since I have 2 free ports available, I want to use built in HPWM generator and ADC for high voltage generation for tube anode supply. Will PBP allow me to do that with above code? I mean will be speed enough to maintain correct voltage levels?

  9. #49
    Join Date
    Sep 2009
    Posts
    696

    Default Re: Need to drive 40 pins on variable change, is there a way to do it in elegant way?

    With large output cap it will, but I wouldn't trust code with pauses to drive stepup.
    Only if you implement ASM interrupts for ADC then it should work reliable.
    You should set one timer to start ADC, after ADC finish, you should turn on or off PWM.
    If your input voltage is known, then set max duty cycle, for maximum current.
    I used pic18f14k50, for stepup. And set pwm to be turned off by comparator. So it will have crude on/off regulation that work independently of code.
    As far as I know that can't be done on 16F1519.

  10. #50
    Join Date
    Feb 2013
    Posts
    427

    Default Re: Need to drive 40 pins on variable change, is there a way to do it in elegant way?

    Well I've tried with bare 16F1519, no other code running, and it delivers quite good result. Code is like this:

    Code:
    do
    ADCIN 1, VOLT
    IF VOLT<1 then X=X+1
    IF VOLT>1 then X=X-1
    HPWM 1,X,32000
    loop
    hpwm output drives IRLZ34 mosfet which in turn drives coilcraft flyback transformer, rectified voltage from which is fed back to ADC via divider.

  11. #51
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    2,803

    Default Re: Need to drive 40 pins on variable change, is there a way to do it in elegant way?

    What is the actual DC output voltage?

    This code is far away from output regulation anyway.

    Ioannis

  12. #52
    Join Date
    Feb 2013
    Posts
    427

    Default Re: Need to drive 40 pins on variable change, is there a way to do it in elegant way?

    Yes this is just "sample" code I wrote now, not actual code, I have it on another PC.

    Output voltage is 180 volts.

  13. #53
    Join Date
    Sep 2009
    Posts
    696

    Default Re: Need to drive 40 pins on variable change, is there a way to do it in elegant way?

    That code produces stable average result for fixed load. But it will oscillate around it, and for nixie that is more than enough.
    BUT, DO NOT USE HPWM COMMAND!!!!
    I learned that hard way. I had 50W sepic converter running from HPWM, and it blows fuses, now and than. At random intervals, with out any apparent reason.
    Problem was HPWM command, when it set new value, it stops timer for short period. So sometimes pin stuck HI at, and while it setting new PWM, drives inductor to saturation.
    So you can use once HPWM to set timers etc. But then write duty cycle directly to registers.

  14. #54
    Join Date
    Feb 2013
    Posts
    427

    Default Re: Need to drive 40 pins on variable change, is there a way to do it in elegant way?

    yes, on each call, HPWM statement "restarts" hardware module, and this can be troublesome under certain circumstances.

  15. #55
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    2,803

    Default Re: Need to drive 40 pins on variable change, is there a way to do it in elegant way?

    This may oscillate around the set 180 volts about 36 volts!

    If I am not wrong, 180 to 5 needs a /36 divider. +/-1volt of control * 36= 36 volts.

    This may be a problem...

    Ioannis

  16. #56
    Join Date
    Feb 2013
    Posts
    427

    Default Re: Need to drive 40 pins on variable change, is there a way to do it in elegant way?

    Yes, as I said, this is just idea example code, real code of course uses more precise values adc is 10 bits anyways....

  17. #57
    Join Date
    Sep 2009
    Posts
    696

    Default Re: Need to drive 40 pins on variable change, is there a way to do it in elegant way?

    Ioannis, Sorry, but you are wrong. Look close at code, and just one reading below 1V will increase PWM, also 1 above will decrease. So just 1LSB is hysteresis.
    So hysteresis is 36*5/255=0.7V. More than enough. With 10bit hysteresis would be negligible. Larger error would be due integral windup as loop is very fast. There is also possibility that X would overflow.

    From this code I don't expect more than +/-10V, with reasonable capacitor.
    Last edited by pedja089; - 4th February 2019 at 18:34.

  18. #58
    Join Date
    Feb 2013
    Posts
    427

    Default Re: Need to drive 40 pins on variable change, is there a way to do it in elegant way?

    I'm further improving my code and will post final version when finished.
    By the way, where's HenrikOlsson ?

  19. #59
    Join Date
    Sep 2009
    Posts
    696

    Default Re: Need to drive 40 pins on variable change, is there a way to do it in elegant way?

    Forgot to say, that PWM duty cycle must be limited. If reach 100%, then it's DC on inductor or primary...

  20. #60
    Join Date
    Feb 2013
    Posts
    427

    Default Re: Need to drive 40 pins on variable change, is there a way to do it in elegant way?

    Yes indeed it's limited

  21. #61
    Join Date
    Feb 2013
    Posts
    427

    Default Re: Need to drive 40 pins on variable change, is there a way to do it in elegant way?

    Since current consumption with nixies is fairly stable and changes with different segments being on (say "1" consumes less current than "8"). I have a proposal how to run this converter along with my code. HPWM can operate by itself, and it will, but control check via ADC will be performed only when display is updated - different segments lit, current consumption changed so duty cycle needs to be adjusted. I guess, that way I can make it run along with my code.

  22. #62
    Join Date
    Sep 2009
    Posts
    696

    Default Re: Need to drive 40 pins on variable change, is there a way to do it in elegant way?

    You can, but it won't be any good. It may work somehow, but that isn't reliable...
    Also there is some time needed to settle new current and new pwm value.

  23. #63
    Join Date
    Feb 2013
    Posts
    427

    Default Re: Need to drive 40 pins on variable change, is there a way to do it in elegant way?

    Well, I'll test and let everyone know....

  24. #64
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    2,803

    Default Re: Need to drive 40 pins on variable change, is there a way to do it in elegant way?

    Oh yes. I was carried away by the VOLT<1 or >1 and concluded you were checking for 1 volt and not 1 LSB.

    Sorry about that.

    Ioannis

  25. #65
    Join Date
    Feb 2013
    Posts
    427

    Default Re: Need to drive 40 pins on variable change, is there a way to do it in elegant way?

    I have an idea. DS1302 is using 3 pins. RST, CLK, IO. What if I connect DS18B20 to RST pin and use it to measure temperature? will it work?

  26. #66
    Join Date
    Jan 2006
    Location
    Istanbul
    Posts
    1,188

    Default Re: Need to drive 40 pins on variable change, is there a way to do it in elegant way?

    Quote Originally Posted by CuriousOne View Post
    I have an idea. DS1302 is using 3 pins. RST, CLK, IO. What if I connect DS18B20 to RST pin and use it to measure temperature? will it work?
    That is already something people do but connecting DS18B20 to Clk or IO should be better.
    "If the Earth were a single state, Istanbul would be its capital." Napoleon Bonaparte

  27. #67
    Join Date
    Feb 2013
    Posts
    427

    Default Re: Need to drive 40 pins on variable change, is there a way to do it in elegant way?

    Code:
    DIM DIGIT1(10) ' say array for ones of minutes
    DIGIT1(0)=PORTB.5
    DIGIT1(1)=PORTC.3
    DIGIT1(2)=PORTE.2
    ….' till we fill all digits
    DIGIT1(9)=PORTD.3
    
    'And then in code
    
    HIGH DIGIT1(say ones of minutes variable)
    It would work on ZX Spectrum, but I assume this won't work with PBP ?

  28. #68
    Join Date
    Sep 2009
    Posts
    696

    Default Re: Need to drive 40 pins on variable change, is there a way to do it in elegant way?

    That will just read state of pin, and put it in array.

  29. #69
    Join Date
    Feb 2013
    Posts
    427

    Default Re: Need to drive 40 pins on variable change, is there a way to do it in elegant way?

    won't statement HIGH DIGIT1(2) set HIGH the port number, stored in DIGIT1(2) ?

  30. #70
    Join Date
    Feb 2013
    Posts
    427

    Default Re: Need to drive 40 pins on variable change, is there a way to do it in elegant way?

    Since I've almost finished development of this clock, including hardware side, and I want to post an instructable, I want to make my code a bit tidy also. I have made several screen update routines, like cross-fade, slot machine effect, running wave and so on. Is it possible to have this code as standalone .bas file, and user just changes include name in main code so appropriate code will be called automatically?

    Name:  aproach.jpg
Views: 17
Size:  116.6 KB
    Last edited by CuriousOne; - 19th February 2019 at 19:35.

  31. #71
    Join Date
    Sep 2009
    Posts
    696

    Default Re: Need to drive 40 pins on variable change, is there a way to do it in elegant way?

    Probably yes. But it depends on how you write code.
    Looks great!

Similar Threads

  1. Can not change variable while using DT_INT?
    By hvguy0 in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 30th March 2013, 00:05
  2. Change a variable to the opposite?
    By Hylan in forum mel PIC BASIC Pro
    Replies: 10
    Last Post: - 21st June 2012, 07:00
  3. LCD DB4-DB7 4bit mode change pins?
    By erice1984 in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 6th March 2009, 02:36
  4. Accessing pins with a variable
    By Desterline in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 20th August 2004, 16:03
  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 : 29

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