My project is starting


Closed Thread
Results 1 to 40 of 92

Hybrid View

  1. #1
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by cncmachineguy View Post
    dave do you ever sleep?
    Sleep is for sissies.
    Dave
    Always wear safety glasses while programming.

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


    Did you find this post helpful? Yes | No

    Default

    I guess I must be, I seem to need at least 4-5 hours now days.

    I got my cards in today So I will be building my cards tomorrow morning and hopefully start programming it.

    As my mind always does, I am already wondering to start thinking about an RS232 to I2c board. Anybody want in on getting something together?
    -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
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by cncmachineguy View Post
    As my mind always does, I am already wondering to start thinking about an RS232 to I2c board. Anybody want in on getting something together?
    Might be an interesting project, but I have not used a bootloader yet of any kind.
    Dave
    Always wear safety glasses while programming.

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


    Did you find this post helpful? Yes | No

    Default

    Well even if it weren't a bootloader, it seems like it could have value as an interface. Yet anoyher way to talk to the animals.
    -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
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Just a thought.

    Have a PIC receive data from the PC serially and squirt the same data out I2C ???
    That would be too easy.
    Dave
    Always wear safety glasses while programming.

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


    Did you find this post helpful? Yes | No

    Default Small success

    I soldered all the smt parts on my card, uP,3311,12 volt driver, and LED's. and of course the ICSP header. Wrote a quik ASM to just turn the LED's on and off and LED's all work! This is a major milestone for me, this is my first dive into SMT.

    Next up on the list, do the same thing using PBP. Of coursethis means figuring out how to pull everything together, IDE, compiling and of course setup stuff for the chip. WOW what an exciting new road I am traveling on today!!

    Of course I have to post this kind of thing here, cuz you guys are the only folks I know that can appreciate these small feats.
    -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!

  7. #7
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Of course I have to post this kind of thing here, cuz you guys are the only folks I know that can appreciate these small feats.
    I know what you mean.

    The first time I did a blinky with a PIC it was around the holidays. I called my wife over and excitedly showed her the LED turning on and off. She looks at it for a bit, walks over to the tree, plugs it in, waits for the lights to start blinking, turns to me and says, "SO". She then leaves the room.
    Dave
    Always wear safety glasses while programming.

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


    Did you find this post helpful? Yes | No

    Default

    For those following this thread, see thread split here for more information about assembly DT_INTS interrupts : http://www.picbasic.co.uk/forum/showthread.php?t=14063
    http://www.scalerobotics.com

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


    Did you find this post helpful? Yes | No

    Default

    Thanks Walter, I was wanting to figure out how to include the other thread so to speak. There is heaps of good stuff in it, so I am glad its not buried in this one.
    -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!

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


    Did you find this post helpful? Yes | No

    Default ADD in full swing here

    Well, not that I need to be thinking about this yet, but in anticpation of "phase III" Anybody have any ideas for ram? I think I will be looking for at least 2-4K. The more the merrier. I do have scads of DDR sticks, that would be cool. Or I was thinking about SD cards, they would be way convinent. But at this point I am still just thinking.
    -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!

  11. #11
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    SD is kind of slow, I here FRAM is fast.
    Dave
    Always wear safety glasses while programming.

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


    Did you find this post helpful? Yes | No

    Default

    Pretty cool looking stuff that F-RAM. I ordered some samples of the 5V I2C 512Kb guys. From Mouser I can buy them (Ok, $11 each for these big guys) but free samples is free! I really doubt i need this big. The 64Kb (yes boys and girls - thats kilo-bit) are only $3.xx each in small numbers.

    Thanks Dave, now I can go back to finishing phase I
    -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!

  13. #13
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,172


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by mackrackit View Post
    ...FRAM is fast.
    And they never wear...

    Ioannis

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


    Did you find this post helpful? Yes | No

    Default Things are working, kinda

    Here is my latest code. All this really does is check for switches and disable drives, and shift PORTa to PORTc every 5 uS. It also sends a servo pulse out every 20mS with a pulse time sweeping from 1-2 ms just for testing purposes.

    Right now, everything seems to work, but I need to remove the RED line from the interupt. When I comment it out, it seems to hang in the interupt and never leave. Uncomment and it works again. I have been struggling with this for a week, so I figured I would just ask and get the answer.
    Code:
    ' Name        : Interface card.pbp
    ' Compiler    : PICBASIC PRO Compiler 2.6A
    ' Assembler   : MPASM
    ' Target PIC  : 16F1947
    ' Hardware    : PIMill Interface 
    ' Oscillator  : internal
    ' Keywords    : 
    ' Description : PICBASIC PRO program to interface parallel port
    ' to 4 stepper drives and limit switches
    '
    
    '
    ' 
    '
    ' Configure ports
    ' 
    ' 
    ANSELA = %00000000  'port A all 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 = %00010000 'LED's 0 for red, 1 FOR GREEN should start red
    LATF = %00001111 ' low nibble is drive enable. 1 disables
    LATG = %00000000
    
    ' I/O direction
    
    TRISA = %11111111'step and dir inputs
    TRISB = %11000001'7-0 icsp,icsp,h4o,h3o,h2o,h1o,estopO,enable In
    TRISC = %00000000'step and dir outputs
    TRISD = %00000000'led6,i2c,i2c,led5,led4,led3,led2,led1
    TRISE = %11111111'ls4,lsh4.ls3,lsh3,ls2,lsh2,ls1,lsh1
    TRISF = %00010000'spindle dir,servo out,dac out,flood input,4en,3en,2en,1en
    TRISG = %11100111'x,x,icsp/mclr,rly2,rly1,Rx2,Tx2,DI
    
    
    
    
    '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 & _BORV_25 & _LVP_OFF
    
    'Internal osc setup
    OSCCON = %11110000 'clock is 8 meg. turn on PLL for 32 meg clock
    DEFINE OSC 32
    
    'Variables
    LED0    VAR PORTD.0   ' Assign name "LED" to PORTD
    LED1	VAR PORTD.1
    LED2	VAR PORTD.2
    LED3    VAR PORTD.3
    LED4    VAR PORTD.4
    LED5	VAR PORTD.7
    
    SERVO   VAR PORTF.6
    CNT 	VAR BYTE
    
    MYFLAGS VAR BYTE
    COUNTUP VAR MYFLAGS.0
    COUNTDN VAR MYFLAGS.1
    MS      VAR MYFLAGS.2
    
    ENALL   VAR PORTB.0
    TEMPF   VAR BYTE
    FRAMECOUNT VAR BYTE
    POS     VAR BYTE
    EN1		VAR PORTF.0
    EN2     VAR PORTF.1
    EN3     VAR PORTF.2
    EN4     VAR PORTF.3
    
    COUNTUP = 1
    COUNTDN = 0
    POS = 1
    FRAMECOUNT = 0
    MS = 0
    CNT = 0
    
    '5.0 uSec OR 200,000 Hz INTERRUPTS
    'PRELOAD 39 PR = NUMBER OF CYCLES-1
    'INT HANDLER COMPLIMENTS OF DARREL TAYLOR 
    PRELOAD     VAR byte
    PRELOAD =  39 ' FROM TESTING TO FIND THE RIGHT NUMBER
    PR2 = PRELOAD
    PIE1.1 = 1        ; Enable Timer2 interrupts
    INTCON.6 = 1      ; enable PEIE
    INTCON.7 = 1      ; enable GIE
    T2CON = %00000100 ; Start Timer2
    
    DEFINE INTHAND _FiveMicroSec
    
    '---[TMR2 - interrupt handler]--------------------------------------------------
    FiveMicroSec:
        LATF = LATF ^ 1     ;  TOGGLE EN1
        CNT =CNT+1
    
        PORTC = PORTA
        PIR1.1 = 0          ; clear the interrupt flag
    @ NOP
    @ RETFIE
    
    
    Main:      'DO WHATEVER YOU WANT HERE
     
      IF ENALL = 0 THEN
       GOTO NOTREADY  
      ELSE  
       GOTO READY 
      ENDIF
    READYRETURN:
      IF CNT >= 200 THEN
    '	TOGGLE EN2
    	TOGGLE LED5
    	CNT=0
        FRAMECOUNT = FRAMECOUNT + 1
        MS = 1
      ENDIF
      IF FRAMECOUNT >=20 THEN
    	FRAMECOUNT = 0
        MS=0
    	HIGH SERVO
    	IF COUNTUP THEN POS = POS + 1
    	IF COUNTDN THEN POS = POS - 1
      ENDIF
       
    '  TOGGLE LED2
      IF PORTE != $FF THEN SWITCHHIT
      
      GOTO SERVOCHECK 
    GOTO Main
    
    SERVOCHECK:
       IF MS =1 THEN
        IF CNT >= POS THEN
         LOW SERVO
    	 MS =0
          
    	 IF (COUNTUP = 1) AND (POS=199) THEN
          COUNTUP = 0
    	  COUNTDN = 1
    	 ELSE 
           IF POS = 1 THEN
    	     COUNTUP = 1
    	     COUNTDN = 0
           ENDIF
         ENDIF
        ENDIF
       ENDIF
       GOTO MAIN	
    SWITCHHIT:
       PORTF = PORTF | $0F
       IF (PORTE = 253) OR (PORTE = 254) THEN LED0 = 0
       IF (PORTE = 247) OR (PORTE = 251) THEN LED1 = 0
       IF (PORTE = 223) OR (PORTE = 239)  THEN LED2 = 0
       IF (PORTE = 127) OR (PORTE = 191) THEN LED3 = 0
    '  ELSE PORTE = PORTE |$0F		
       GOTO MAIN
    
    NOTREADY:
       PORTD = PORTD & $F0
       PORTF = PORTF | $0F
       IF ENALL = 0 THEN NOTREADY
       PORTD = PORTD | $0F
       PORTF = PORTF & $F0
       GOTO MAIN
    READY:
       PORTF = PORTF & $F0
       PORTD = PORTD | $0F
       GOTO READYRETURN
    -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