EASYPIC4 Board Giveaway


Closed Thread
Results 1 to 40 of 52

Hybrid View

  1. #1
    Join Date
    Aug 2010
    Location
    Maryland, USA
    Posts
    869


    Did you find this post helpful? Yes | No

    Default Re: EASYPIC4 Board Giveaway

    you have shamed me into it. LOL!

    I am putting it together now, likely I will slide in just under the april 30 deadline.
    -Bert

    The glass is not half full or half empty, Its twice as big as needed for the job!

    http://foamcasualty.com/ - Warbird R/C scratch building with foam!

  2. #2
    Join Date
    Aug 2010
    Location
    Maryland, USA
    Posts
    869


    Did you find this post helpful? Yes | No

    Default Re: EASYPIC4 Board Giveaway

    Heres my code so far. It appears to work as needed, but thus far I have only tested it with a sim. I will try and put the hardware together tonight and test it in real time.
    Code:
    ' Name        : RMTEO Contest 2.pbp
    ' Compiler    : PICBASIC PRO Compiler 2.6A
    ' Assembler   : MPASM
    ' Target PIC  : 16F1947
    ' Hardware    : RMTEO Contest
    ' Oscillator  : internal
    ' Keywords    :
    ' Description : PICBASIC PRO program to drive 4 LED's at independent speeds
    ' adjustable from 4 pot's. fade from 0-100-0% for each cycle
    '
    '
    '
    '
    ' Configure ports
    '
    '
    ANSELA = %00001111  'port A 0-3 analog 4-7 digital
    ANSELE = %00000000  'port E all digital
    ANSELF = %00000000  'port F all digital
    ANSELG = %00000000  'port G all digital
    CM1CON0 = %00000000  'No comparaters
    CM1CON1 = %00000000
    CM2CON0 = %00000000
    CM2CON1 = %00000000
     
    ' preload latches before setting direction
     
    LATB = %00000000
    LATC = %00000000
    LATD = %00000000 'LED's 0 for red, 1 FOR GREEN should start red
    LATF = %00000000 ' low nibble is drive enable. 1 disables
    LATG = %00000000
     
    ' I/O direction
     
    TRISA = %00001111'x,x,x,x,p3,p2,p1,p0
    TRISB = %00000000'x,x,x,x,led3,led2,led1,led0
    TRISC = %00000000'UNUSED
    TRISD = %00000000'UNUSED
    TRISE = %00000000'UNUSED
    TRISF = %00000000'UNUSED
    TRISG = %00000000'UNUSED
     
     
    'REMOVE THIS LINE IF NOT SETTING THE CONFIGS IN CODE SPACE
     
    @ __config _CONFIG1,_FOSC_INTOSC & _WDTE_OFF & _PWRTE_OFF & _MCLRE_OFF & _CP_OFF & _CPD_OFF & _BOREN_OFF & _CLKOUTEN_OFF & _IESO_OFF & _FCMEN_OFF
    @ __config _CONFIG2,_WRT_OFF & _VCAPEN_OFF & _PLLEN_ON & _STVREN_OFF & _LVP_OFF ;_BORV_25
     
    '------------------Internal osc setup
    OSCCON = %11110000 'clock is 8 meg. turn on PLL for 32 meg clock
    DEFINE OSC 32
    DEFINE NO_CLRWDT 1
     
    'Variables
     
    'Port assignments     
     
    '------------------port B
     
    '---------------------words
    freqs1  var word
    freqs2  var word
    freqs3  var word
    freqs4  var word
    freq1   var word
    freq2   var word
    freq3   var word
    freq4   var word
     
    '---------------------Bytes
    TICKS   VAR BYTE
    display VAR BYTE
    duty1   VAR BYTE
    duty2   VAR BYTE
    duty3   VAR BYTE
    duty4   VAR BYTE
    myflags var byte
     
    '---------------------Bits
     led1   var display.0
     led2   var display.1
     led3   var display.2
     led4   var display.3
     
     df1    var myflags.0
     df2    var myflags.1
     df3    var myflags.2
     df4    var myflags.3
    '---------------------INIT VARIABLE VALUE
     
    GOTO START
    MYINIT:
    BSR = 0
    TICKS = 0
    freqs1 = 128
    freqs2 = 256
    freqs3 = 512
    freqs4 = 1023
    duty1 = 0
    duty2 = 0
    duty3 = 0
    duty4 = 0
    display = 0
    MYFLAGS = 0
     
    '-------------------A/D setup
    adcon0 = %00000001
    adcon1 = %11100000
    define ADC_BITS 10
     
    '-------------------10uS interrupt setup
    DEFINE INTHAND _TimeBase
    PIR1.1 = 0
    PIE1.1 = 1        ; Enable Timer2 interrupts
    INTCON.6 = 1      ; enable PEIE
    INTCON.7 = 1      ; enable GIE
    T2CON = %00000100 ; Setup Timer2 AND SET PRESCALE TO 1:1. @32Mhz THE Interrupt
    PR2 = 39'                 FOR TMR2 WILL BE 10uSec
    RETURN
     
    '---------------------start of program
    START:
       GOSUB MYINIT
    MAIN:
     
     adcin 0,freqs1   
    '-------------------------led1 math
        if ticks>duty1 then
            led1 = 0
        else
            led1 = 1
        endif
        if freq1 > freqs1 then
            if df1 then 
                duty1=duty1+1
            else
                duty1=duty1-1
            endif
            if duty1=100 then df1=0
            if duty1=0 then df1 = 1
            freq1 = 1
        endif
     
     adcin 1,freqs2   
    '------------------------led2 math
        if ticks>duty2 then
            led2 = 0
        else
            led2 = 1
        endif
        if freq2 > freqs2 then
            if df2 then 
                duty2=duty2+1
            else
                duty2=duty2-1
            endif
            if duty2=100 then df2=0
            if duty2=0 then df2 = 1
            freq2 = 1
        endif
     
    adcin 2,freqs3
    '------------------------led3 math
    if ticks>duty3 then
            led3 = 0
        else
            led3 = 1
        endif
        if freq3 > freqs3 then
            if df3 then 
                duty3=duty3+1
            else
                duty3=duty3-1
            endif
            if duty3=100 then df3=0
            if duty3=0 then df3 = 1
            freq3 = 1
        endif
     
     adcin 3,freqs4   
    '---------------------------led4 math
    if ticks>duty4 then
            led4 = 0
        else
            led4 = 1
        endif
        if freq4 > freqs4 then
            if df4 then 
                duty4=duty4+1
            else
                duty4=duty4-1
            endif
            if duty4=100 then df4=0
            if duty4=0 then df4 = 1
            freq4 = 1
        endif
        GOTO MAIN
     
    '-----------------------ISR
    TimeBase:
        BSR = 0
        portb = display ' update led's
     
        freq1 = freq1 +1
        freq2 = freq2 +1
        freq3 = freq3 +1
        freq4 = freq4 +1
        if ticks >99 then
         ticks = 0
        else
         ticks = ticks+1
        endif
     
        pir1.1 = 0          ' clear interrupt
    @ RETFIE
    All comments welcome. I did this all software (no hardware PWM) as I thought it would be more fun.

    Thanks for the contest RMTEO! Sorry I seem to be the only one entering.
    -Bert

    The glass is not half full or half empty, Its twice as big as needed for the job!

    http://foamcasualty.com/ - Warbird R/C scratch building with foam!

  3. #3
    Join Date
    May 2007
    Posts
    604


    Did you find this post helpful? Yes | No

    Default Re: EASYPIC4 Board Giveaway

    Yes, it will be interesting to see how it works!
    Why pay for overpriced toys when you can have
    professional grade tools for FREE!!!

  4. #4
    Join Date
    Aug 2010
    Location
    Maryland, USA
    Posts
    869


    Did you find this post helpful? Yes | No

    Default Re: EASYPIC4 Board Giveaway

    Well I am done at work today, so home I go and hopefully get this put together and running.

    Then to figure out about posting video - always something new and fun
    -Bert

    The glass is not half full or half empty, Its twice as big as needed for the job!

    http://foamcasualty.com/ - Warbird R/C scratch building with foam!

  5. #5
    Join Date
    Aug 2010
    Location
    Maryland, USA
    Posts
    869


    Did you find this post helpful? Yes | No

    Default Re: EASYPIC4 Board Giveaway

    OK, I have my working do-hicky video'ed. Anybody have any suggestions how to get it from my iphone4 to here?

    I know how to upload it to facebook, but what good is that?
    -Bert

    The glass is not half full or half empty, Its twice as big as needed for the job!

    http://foamcasualty.com/ - Warbird R/C scratch building with foam!

  6. #6
    Join Date
    Feb 2006
    Location
    Gilroy, CA
    Posts
    1,530


    Did you find this post helpful? Yes | No

    Default Re: EASYPIC4 Board Giveaway

    If you can get it to youtube, that is probably the easiest way. Then add the link to your post, like this {video}your youtube link{/video} but with the other kind of brackets.

  7. #7
    Join Date
    Aug 2010
    Location
    Maryland, USA
    Posts
    869


    Did you find this post helpful? Yes | No

    Default Re: EASYPIC4 Board Giveaway

    Oh dear. Guess it's time I learn to post on you tube now. I hope I figure it out before the deadline. Ok, I'll be back in a little bit.
    -Bert

    The glass is not half full or half empty, Its twice as big as needed for the job!

    http://foamcasualty.com/ - Warbird R/C scratch building with foam!

Members who have read this thread : 0

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