[SOLVED !] 33EP512MU810 Tripple Processor System Working well Communicates at 920Kb+


+ Reply to Thread
Results 1 to 12 of 12
  1. #1
    Member matty's Avatar
    Join Date
    Dec 2003
    Posts
    119
    Thumbs Up
    Received: 8
    Given: 3
    Total Downloaded
    303.76 MB

    2 Not allowed!

    Default 33EP512MU810 Tripple Processor System Working well Communicates at 920Kb+

    Hi everyone I have just started my first Proton 24 Project and its going very very well so far
    This is my first attempt at using proton 24. The Tripple MCU Project follows on from the thread below

    http://www.protonbasic.co.uk/showthr...etween-3-MCU-s

    I need a tripple processor voting system for redundancy where each MCU communicates with the other two processors every 1ms the details are long and explained in the above post.

    I decided to buy 3 * 33EPMU512MU810 Processor development boards and wire them all together for fast communications.

    The hard part was understanding PPS Peripheral Pin Select.

    After weeks of hard labour with the data sheet I have got it working. Hurray and I want to share it with you all

    TX1, TX2, Rx1, RX2 are used to inter-communicate between all three processors extreemly fast 800KB baud rate and works very reliably.

    All of my RX code is completley Interrupt Driven and Hand coded. It took me a long time weeks but I eventually got the data in RX1,RX2 very very quickly using a Hardware ISR for RX1 and RX2 recieve events

    The TX code is clever use of HRSout took very long time so I hand coded a char: routine to spit out the data for TX1 and TX2 byte by byte very very quickly. At every stage checking the TXBuff is empty before sending the next byte.

    TX3,RX3 simply transmitt the data recieved from the other two processors off to hyper terminal through a MAX232 chip. It works great as I watch TX3 on hyper terminal all 5 words come from the other two MCU's if I individually hang each MCU with MCLR pushbutton then the data for that channle goes blank and then reappears.

    Amazing how fast MCU is

    I toggle a pin high when doing the TX part and then low untill 1mS Later when a 1mS Interrupt has expired

    I have a 1ms Timer so every 1mS it sends a burst of data

    The pin toggles high and goes low so I can see I transmitt 22 Bytes of data
    5 words = 10 bytes + end of packet (11 bytes tx1)
    5 Words = 10 bytes + end of packet (12 bytes tx2)

    --_____________________--_________________--_____________--_______ ' portG.13 viewed on an oscilloscope
    90uS 1ms 90us 1ms 90us 1ms 90uS

    [email protected] baudrate of 920Kb I send 22 complete bytes in 90uS

    It is all working nice I can send 22 Bytes of data 10 words with 2 end of packet indicators ina lightening fast 90uS

    The next task I have to get the 5 * A/D Inputs working @ 12 bits resoloution
    and PWM working to drive a motor

    But for now I have proved the concept that this part clocked at 140Mhz 70 Mips is fast enough to send the data all the data every in 90uS once every 1ms.

    Please attached files

    Code Below.
    Code:
    'TMR Tripple Modular Redundancy
    'Tripple MCU Voting system 3 MCU's fast communication 
    
    
        Device = 33EP512MU810 '100 pin tqfp
                
        Declare Xtal = 140 'was 140
        
        'PLL_Setup(76, 2, 2, $0300) only examples can find are for internal oscillator
        'the above macro locks PLL but can nott find an example for ext 8MHz Xtal
        CLKDIV.7 = 0 'PLL POST (set to divide by 2)
        CLKDIV.6 = 0 'PLL POST (set to divide by 2)
        
        CLKDIV.4=0 ' PLL POST (set to divide by 2)
        CLKDIV.3=0 ' PLL POST (set to divide by 2)
        CLKDIV.2=0 ' PLL POST (set to divide by 2)
        CLKDIV.1=0 ' PLL POST (set to divide by 2)
        CLKDIV.0=0 ' PLL POST (set to divide by 2)
        
        PLLFBD.8=0'70MIPS
        PLLFBD.7=0
        PLLFBD.6=1
        PLLFBD.5=0
        PLLFBD.4=0
        PLLFBD.3=0
        PLLFBD.2=1
        PLLFBD.1=0
        PLLFBD.0=0
     
    
    
    Config FICD = ICS_PGD1,JTAGEN_OFF
    Config FPOR = ALTI2C1_ON,BOREN_OFF,FPWRT_PWR32
    Config FWDT = WDTPOST_PS256,PLLKEN_OFF,WINDIS_OFF,FWDTEN_OFF
    Config FOSC = POSCMD_HS,OSCIOFNC_OFF,FCKSM_CSECME
    Config FOSCSEL = FNOSC_PRIPLL,IESO_OFF
    Config FGS = GWRP_OFF
    Config FAS = AWRP_OFF,APLK_OFF
    '------------------------------------------------------------------------- 
    
    
    'Output PORTG.15 cant use that its for the bootloader mode !!
    
    
    Input  PORTF.12 'pin 40 RP108 U1RX
    Output PORTF.13 'pin 39 RP109 U1TX
    
    
    '----------U1  TX RX Setup  --------------------------------------------------
    
    
    U1MODEbits_STSEL = 0 '1 STOP BIT
    'U1MODEbits_PDSEL = 0 'NO Parity, 8 data COMPILER WONT RECOGNISE COMMAND
    U1MODEbits_ABAUD = 0
    U1MODEbits_brgh = 0
    
    
    U1BRG = 4 '37=115200'75=56700bps '(140mhZ / 115,200)/16 - 1 = 74.95 ~ 75 INTEGER
    
    
    'DECIDED NOT TO HAVE INTERRUPT DRIVEN TX FOR NOW MIGHT USE LATER TO OPTIMISE
    'u1sta.15 = 0 'interrupt after one tx character
    'u1sta.13 = 0 'is transmitted
    'IEC0bits_U1TXIE = 1 'enable tx interrupt
    
    
    u1modebits_uarten = 1 'enable uart
    U1STA.10 = 1 'Enable uart TX Bit 10 
    
    
    RPOR12 = 0                 'clears
    RPOR12 = 00000000000001 ' pps output reg mapped u1tx pin 39
    
    
    RPINR18 = 0                'CLEARS
    RPINR18 = 00000001101100 'pps output reg mapped U1RXPIN 40 
    
    
    Clear IEC0bits_U1RXIE 'clear U1 RX Interrupt
    Clear IFS0bits_U1RXIF 'clear U1 RX Interrupt flag                         
    Set IEC0bits_U1RXIE   'Set U1 RX Interrupt
    
    
    U1STA.7=0'0 interrupt is set when any character is recieved
    U1STA.6=0'x interrupt enabled when any character is recieved
    '-------- end of u1 tx and rx setup ----------------------------------
    
    
    '--------- u2 TX and RX setup ----------------------------------------
    Input  PORTD.14 'pin 47 RPI78 U2 RX   'RPI78 not RP178!!!!!
    Output PORTD.15 'pin 48 RP79 U2 TX
    
    
    U2MODEbits_STSEL = 0 '1 STOP BIT
    'U2MODEbits_PDSEL = 0 'NO Parity, 8 data COMPILER WONT RECOGNISE COMMAND
    U2MODEbits_ABAUD = 0
    U2MODEbits_brgh = 0
    
    
    U2BRG = 4'37 '37=115200'75=56700bps '(140mhZ / 115,200)/16 - 1 = 74.95 ~ 75 INTEGER
    
    
    'DECIDED NOT TO HAVE INTERRUPT DRIVEN TX FOR NOW MIGHT USE LATER TO OPTIMISE
    'u2sta.15 = 0 'interrupt after one tx character
    'u2sta.13 = 0 'is transmitted
    'IEC0bits_U2TXIE = 1 'enable tx interrupt
    
    
    u2modebits_uarten = 1 'enable uart
    U2STA.10 = 1 'Enable uart TX Bit 10 
    
    
    RPOR4 = 0                 'clears
    RPOR4 = 00000000000011 ' pps output reg mapped u2tx pin 48
    
    
    RPINR19 = 0                'CLEARS
    RPINR19 = 00000001001110'pps input reg mapped U1RXPIN 40 
    
    
    Clear IEC1bits_U2RXIE 'clear U1 RX Interrupt
    Clear IFS1bits_U2RXIF 'clear U1 RX Interrupt flag                         
    Set IEC1bits_U2RXIE   'Set U1 RX Interrupt
    
    
    U2STA.7=0'0 interrupt is set when any character is recieved
    U2STA.6=0'x interrupt enabled when any character is recieved
    '-------- end of U2 Tx and Rx setup ----------------------------------
    
    
    '''''''''''' U3 Tx and Rx Setup --------------------------------------
    Input  PORTG.0 'pin 90 RP112 U3 RX   '
    Output PORTG.1 'pin 89 RP113 U2 TX
    
    
    'U3MODEbits_STSEL = 0 '1 STOP BIT
    ''U2MODEbits_PDSEL = 0 'NO Parity, 8 data COMPILER WONT RECOGNISE COMMAND
    'U3MODEbits_ABAUD = 0
    'U3MODEbits_brgh = 0
    
    
    'U3BRG = 37'37 '37=115200'75=56700bps '(140mhZ / 115,200)/16 - 1 = 74.95 ~ 75 INTEGER
    
    
    'DECIDED NOT TO HAVE INTERRUPT DRIVEN TX FOR NOW MIGHT USE LATER TO OPTIMISE
    'u2sta.15 = 0 'interrupt after one tx character
    'u2sta.13 = 0 'is transmitted
    'IEC0bits_U2TXIE = 1 'enable tx interrupt
    
    
    'u3modebits_uarten = 1 'enable uart
    'U3STA.10 = 1 'Enable uart TX Bit 10 
    
    
    Declare Hserial3_Baud = 115200'9600
    Declare Hrsout3_Pin = PORTG.1
    Declare HRSin3_pin = PORTG.0
    
    
    
    
    RPOR13 = 0                 'clears
    RPOR13 = 00000000011011 ' pps output reg mapped u3tx pin 89
    
    
    RPINR27 = 0                'CLEARS
    RPINR27 = 00000001110000'pps input reg mapped U3RXPIN 90 
    
    
    'Clear IEC5bits_U3RXIE 'clear U1 RX Interrupt
    'Clear IFS5bits_U3RXIF 'clear U1 RX Interrupt flag                         
    'Set IEC5bits_U3RXIE   'Set U1 RX Interrupt
    
    
    'U3STA.7=0'0 interrupt is set when any character is recieved
    'U3STA.6=0'x interrupt enabled when any character is recieved
    
    
    '-------- end of U3 Tx and Rx setup ----------------------------------
    
    
    
    
    
    
    
    
    Output PORTG.13 'pin 97 Toggle pin see how fast MCU executes loop on scope
    
    
    Output PORTG.14 'tells other 2 mcus full valid packet recieved
    
    
    Input PORTD.13 'checks if other MCU has recieved ful packet
    Input PORTD.12 'checks if other MCU has recieved full packet
    
    
    
    
    PORTG.14 = 0 'initially clear sync control
    
    
    
    
    Dim a As Float 'float var1
    a = 1000
    Dim b As Float 'float var2
    b = 10000
    Dim c As Float 'float var3
    c = 100000
    
    
    Dim loop As Byte 'floating point repeat loop pointer
    loop = 0
    
    
    Dim d As Word 'test variable
    d = 1000
    
    
    Dim REC As Byte 'char recieved U1 Rx Interrupt    
    REC = 0
    
    
    Dim REC1 As Byte 'char recieved U2 Rx Interrupt
    REC1 = 0
    
    
    Dim my_demand As Word 'word1
    my_demand = 1000
    Dim my_demandA As Word 'word1
    my_demandA = 0
    Dim my_demandB As Word 'word1
    my_demandB = 0
    
    
    
    
    Dim my_feedback As Word 'word2
    my_feedback = 2000
    Dim my_feedbackA As Word 'word2
    my_feedbackA = 0
    Dim my_feedbackB As Word 'word2
    my_feedbackB = 0
    
    
    
    
    Dim my_error As Word   'word3
    my_error = 3000
    Dim my_errorA As Word   'word3
    my_errorA = 0
    Dim my_errorB As Word   'word3
    my_errorB = 0
    
    
    
    
    Dim my_current1 As Word 'word4
    my_current1 = 4000
    Dim my_current1A As Word 'word4
    my_current1A = 0
    Dim my_current1B As Word 'word4
    my_current1B = 0
    
    
    
    
    
    
    
    
    Dim my_current2 As Word 'word5
    my_current2 = 5000
    Dim my_current2A As Word 'word5
    my_current2A = 0
    Dim my_current2B As Word 'word5
    my_current2B = 0
    
    
    
    
      
    Dim loop1 As Byte
    loop1 = 0
                 
    Dim intout [13] As Byte
    
    
    Dim bufcount As Byte
    bufcount = 0
    
    
    Dim bufcount2 As Byte
    bufcount2 = 0
    
    
    Dim tx1 [13] As Byte
    Dim tx2 [13] As Byte
    
    
    Dim sendrecieved As Word
    sendrecieved = 0
    
    
    'timer1 initialise stolen from a c program I wrote for 33fj32gp202
    T1CONbits_TON = 0';
    T1CONbits_TCS=0';
    T1CONbits_TGATE =0';
    'T1CONbits_TCKPS = 0b00';
    TMR1=0x00';
    PR1 = 297'250'1000'; '// PIR settings  PIR = 500 was 8uS /PIR = 1600 was 25uS /PIR = 65000 was 1ms
    '//IPC1bits.T1IP = 0x01;
    '//IFS0bits.T1IF = 0;
    IEC0bits_T1IE = 1';
    T1CONbits_TON = 1';
    
    
    
    
    Dim flag As Byte
    flag = 0
    Dim gotdata As Byte
    gotdata = 0
    
    
    Main:
    ''''''''''''''''''''''coms to hyper terminal to show characters recieved
    Inc sendrecieved
    Select sendrecieved
    Case 100
    my_demandA.LowByte = tx1[1]
    my_demandA.HighByte = tx1[2]
    my_demandB.LowByte = tx2[1]
    my_demandB.HighByte = tx2[2]
    HRSOut3 Dec my_demandA,13
    HRSOut3 Dec my_demandB,13
    Case 200
    my_feedbackA.LowByte = tx1[3]
    my_feedbackA.HighByte = tx1[4]
    my_feedbackB.LowByte = tx2[3]
    my_feedbackB.HighByte = tx2[4]
    HRSOut3 Dec my_feedbackA,13
    HRSOut3 Dec my_feedbackB,13
    Case 300
    my_errorA.LowByte = tx1[5]
    my_errorA.HighByte = tx1[6]
    my_errorB.LowByte = tx2[5]
    my_errorB.HighByte = tx2[6]
    HRSOut3 Dec my_errorA,13
    HRSOut3 Dec my_errorB,13
    Case 400
    my_current1A.LowByte = tx1[7]
    my_current1A.HighByte = tx1[8] 
    my_current1B.LowByte = tx2[7]
    my_current1B.HighByte = tx2[8]
    HRSOut3 Dec my_current1A,13
    HRSOut3 Dec my_current1B,13
    Case 500
    my_current2A.LowByte = tx1[9]
    my_current2A.HighByte = tx1[10]
    my_current2B.LowByte = tx2[9]
    my_current2B.HighByte = tx2[10]
    HRSOut3 Dec my_current2A,13
    HRSOut3 Dec my_current2B,13,13
    sendrecieved = 0
    'clear the variables so if rx / tx wires come loose data vanishes
    tx1[1] = 0
    tx1[2] = 0
    tx2[1] = 0
    tx2[2] = 0
    tx1[3] = 0
    tx1[4] = 0
    tx2[3] = 0
    tx2[4] = 0
    tx1[5] = 0
    tx1[6] = 0
    tx2[5] = 0
    tx2[6] = 0
    tx1[7] = 0
    tx1[8] = 0
    tx2[7] = 0
    tx2[8] = 0
    tx1[9] = 0
    tx1[10] = 0
    tx2[9] = 0
    tx2[10] = 0
    EndSelect
    
    
    
    
    'For loop = 0 To 100 'do 4 CPU Intensive floating point operations  
    'a = b * c
    'b = a * 1000
    'c = b / 100000 
    'c = a * 10
    'Next loop
    
    
    'loads up the data to be transmitted to the other two mcu's
    intout[0]= my_demand.LowByte '1000
    intout[1]= my_demand.HighByte
    intout[2]= my_feedback.LowByte '2000
    intout[3]= my_feedback.HighByte
    intout[4]= my_error.LowByte    '3000
    intout[5]= my_error.HighByte
    intout[6]= my_current1.LowByte '4000
    intout[7]= my_current1.HighByte
    intout[8]= my_current2.LowByte  '5000
    intout[9]= my_current2.HighByte
    intout[10]=$AA                  'end of data packet marker $AA = 10101010
    '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    
    
    
    
    '''''''''''''transmits the 22 bytes of data via charout subroutine ''''''''''''''
    hold:
    If flag = 1 Then '1ms has passed from 1ms timer
    
    
    PORTG.13 = 1   '100us pulse to oscillscope time to transmit 22 bytes every 1ms
    For loop = 0 To 10 'tx 22 bytes ,5 words to UTX1 5 words UTX2 + end of packets
    GoSub charout      'sub routine to transmit tx1 and tx2 bytes
    Next loop1         'repeats the transmit subroutine 10 times 
    flag = 0           'clears flag so another 1mS must pass before another tx loop
    Else
    GoTo hold
    EndIf              'end of tx loop
    
    
    PORTG.13 = 0       'turns 100us pulse off will goe low till 1ms passes and repeats
    
    
    GoTo Main
    
    
    '----------------------------------------------------------------------------
    charout: 'Fast TX Routine to transmit data to the other 2 Processors
    
    
    If U1STA.9 = 1 Then 'if U1 Transmit buffer is full wait 
    GoTo charout:
    Else                'otherwise U1 Transmitt buffer is empty send next byte
    U1TXREG = intout [loop]
    EndIf
    
    
    holdTX2:
    If U2STA.9 = 1 Then  'if U2 Transmitt buffer is full wait
    GoTo holdTX2
    Else                'otherwise u2 transmitt buffer is empty send next byte
    U2TXREG = intout [loop] 
    EndIf
    
    
    Return 'exits txout function back to main prog
    '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    
    
    
    
    
    
    '''''''''''''''''''''''interrupts for individual sources ''''''''''''''''''''
    Isr U1RXInterrupt
        Inc bufcount
        'If bufcount= 11 Then bufcount = 1 'resets counter next packet of 10 bytes arrived
        tx1[bufcount] = U1RXREG
        If tx1[bufcount] = $AA Then bufcount = 0 
    Clear IFS0bits_U1RXIF
    EndIsr
    '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    Isr U2RXInterrupt
        Inc bufcount2
        'If bufcount2 = 11 Then bufcount2 = 1
        tx2 [bufcount2] = U2RXREG
        If tx2[bufcount2] = $AA Then bufcount2 = 0
    Clear IFS1bits_U2RXIF
    EndIsr
    '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    Isr U3RXInterrupt
        REC = U3RXREG
    Clear IFS5bits_U3RXIF
    EndIsr
    '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    Isr T1Interrupt
    'Toggle portg.13
    Clear IFS0bits_T1IF
    flag = 1
    EndIsr
    '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    
    
    
    
    '''''''''''''''not used'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    'ISR U1TXInterrupt 'this can be used in future to optimes tx speed
    'Clear IFS0bits_u1txif
    'u1txreg = rec
    'endisr
    As I watch any 2 of the 3 MCU channles on the scope the 90uS pulses are drifting past eachother this is expected they are not synchronised at all

    Next i have to figure out how to synchronise the 3 MCU's together so when viewed on a scope the 90uS pulse or tx happens at the same time on all three MCU's so they are in step with each other.
    Attached Thumbnails Attached Thumbnails DSCF0141.jpg‎   DSCF0144.jpg‎   overview.JPG‎   3 channle system overview.JPG‎  

Attention

This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

The advertisements we display are relevant to this web site and your browsing history

Please consider supporting us by disabling your ad blocker.


Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

If you can, please report issues in the forum area WebSite / Forum Issues


Thank you for your attention.

  • #2
    Prolific Poster pic-ignorant's Avatar
    Join Date
    Oct 2007
    Posts
    2,938
    Thumbs Up
    Received: 25
    Given: 31
    Total Downloaded
    926.61 MB

    0 Not allowed!

    Default Re: 33EP512MU810 Tripple Processor System Working well Communicates at 920Kb+

    Good job Matty!
    Can I ask What dev boards they are?

  • Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  • #3
    Member matty's Avatar
    Join Date
    Dec 2003
    Posts
    119
    Thumbs Up
    Received: 8
    Given: 3
    Total Downloaded
    303.76 MB

    0 Not allowed!

    Default Re: 33EP512MU810 Tripple Processor System Working well Communicates at 920Kb+

    Dear pic-ignorant

    Thanks very much for the positive feedback I put allot of time into this.

    And a huge huge thanks to Les as I feel I have had a very positive experience with my first taste of proton 24, I just cant believe how fast this 33EP512MU810 device is. I can only imagine how long it took to make the 24 compiler but its great for me it opens a world of oppertunites for me with fast MCUs


    The development boards I found on ebay very cheap about 22.00 link below I only bought them 33EP512MU810 because they needed 4 uarts for my application and is supported by the proton 24 compiler.

    http://www.ebay.co.uk/itm/PIC32-PIC2...bEqFrIY6xabX-Q

    The best part is they come pre-shipped with a 33EP Microchip USB bootlader firmware so you dont need a PICK KIT 3.

    All you do is down load a PC application from microchip, press a button on the PCB and it jumps into bootloader mode

    Then VIA the 33EP512MU810 on board USB Bootloader you flash youre new application to the MCU board.

    Of course it has an ICSP header if you prefer to use a PICK KIT 3 etc to flash the device.

    it also has an on board SD CARD which I may have to use as it dosent look like the 33EP512MU810 has internal EEPROM. Unless I use a 24LC256 8 pin eprom via I2C

    I would love it if other people got this 33EP512MU810 development board then we could do wiki articles on it

    '''''''''''''

    My project is evolving quickly it has to have 3 MCU's for redundancy it will be a high integrity TMR Tripple Modular Redundancy system

    It will be a motor drive actuator positioning system where three processors are all running and then voting logic takes PWM signals of to seperate Motor Drive PCB's. Its so hard and complex to explain the original link explains what my project is all about

    http://www.protonbasic.co.uk/showthr...etween-3-MCU-s

    So far the importance of fast inter communication between the 3 MCU's has been achieved.

    I have now got the three MCU's synchronised by the clever use of two timers
    I have also got the PWM working now.
    I will post the code for this once I have tided it up and improved ' comments

    The next task is to get the 12 bit A/D working.

    I have tried the include "adin.inc" method by followinf from a thread on the 24 forum, but it just seems to hang the MCU when I do MyResult = ADIN 0

    I am going to try and manually configure and do the A/D conversions in 12 bit mode if I get stuck I will post on here.

    The a/d is complex and I will give it a damm good try but if I do get stuck I will post my A/D code on here and ask for help

    Thanks for showing interest and commenting

    Cheers Matthew

  • Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  • #4
    Fanatical Contributor top204's Avatar
    Join Date
    Feb 2002
    Posts
    3,426
    Thumbs Up
    Received: 296
    Given: 142
    Total Downloaded
    1.68 GB

    0 Not allowed!

    Default Re: 33EP512MU810 Tripple Processor System Working well Communicates at 920Kb+

    Thanks Matty. You're going to find the dsPIC and PIC24 devices are actually easier to use that most 8-bit devices.... Except the ADCs on them. I have no idea why they are designed with such complexity, it simply does not make sense. Once the bu#$s8#t from the datasheets is negotiated, they are actually quite straightorward to use as a standard ADC.

    Take a look at the Adin.inc file within the compiler's Includes folder. This shows some of the mecahnisms used for standard ADC operation.

    "C:\Users\User Name\PDS\Includes"

    Also take a look at the DSP codes within the Samples24 directory for simpler ADC init and operation:

    "C:\Users\User Name\PDS\Samples24\DSP"
    Last edited by top204; 15th April 2016 at 11:33.

  • Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  • #5
    Member matty's Avatar
    Join Date
    Dec 2003
    Posts
    119
    Thumbs Up
    Received: 8
    Given: 3
    Total Downloaded
    303.76 MB

    1 Not allowed!

    Cool Re: 33EP512MU810 Tripple Processor System Working well Communicates at 920Kb+

    Dear / Les / PIC-IGNORANT

    I have spent the day trying to learn the A/D convertor in 12 bit mode
    I studied for hours the 33E A/D Converter manual

    I could not get the proton 24 command Myresult = ADIN 0 command to work even when inculde "adin.inc" it just hung the MCU at that command

    So i decided to study the 33E A/D ref manual I got it working and I have just started off reading one channel at 12 bits.

    I have wired a 5 k pot to the 3.3v supply and the wiper arm of the pot goes to up to AN5 rb.5 pin pin 20 of the 100pin tqfp

    and it works 0 - 3.3v = 0-4095

    Code shown Below

    Also I have got the hardware PWM working on PWM1H / porte.1 / pin 94 0f the 11 pin tqfp
    the pwm just sits at a fixed duty cycle for now just to test the PWM works nice at 5 Khz
    PDC1 = 2000 sets the duty cycle to 60% just to test the pwm module



    Code:
    'TMR Tripple Modular Redundancy
    'Tripple MCU Voting system 3 MCU's fast communication 
    
    
        Device = 33EP512MU810 '100 pin tqfp
                
        Declare Xtal = 140 'was 140
        
        'PLL_Setup(76, 2, 2, $0300) 'only examples can find are for internal oscillator
        'the above macro locks PLL but can nott find an example for ext 8MHz Xtal
        
        CLKDIV.7 = 0 'PLL POST (set to divide by 2)
        CLKDIV.6 = 0 'PLL POST (set to divide by 2)
        
        CLKDIV.4=0 ' PLL POST (set to divide by 2)
        CLKDIV.3=0 ' PLL POST (set to divide by 2)
        CLKDIV.2=0 ' PLL POST (set to divide by 2)
        CLKDIV.1=0 ' PLL POST (set to divide by 2)
        CLKDIV.0=0 ' PLL POST (set to divide by 2)
        
        PLLFBD.8=0'70MIPS
        PLLFBD.7=0
        PLLFBD.6=1
        PLLFBD.5=0
        PLLFBD.4=0
        PLLFBD.3=0
        PLLFBD.2=1
        PLLFBD.1=0
        PLLFBD.0=0
     
    
    
    Config FICD = ICS_PGD1,JTAGEN_OFF
    Config FPOR = ALTI2C1_ON,BOREN_OFF,FPWRT_PWR32
    Config FWDT = WDTPOST_PS256,PLLKEN_OFF,WINDIS_OFF,FWDTEN_OFF
    Config FOSC = POSCMD_HS,OSCIOFNC_OFF,FCKSM_CSECME
    Config FOSCSEL = FNOSC_PRIPLL,IESO_OFF
    Config FGS = GWRP_OFF
    Config FAS = AWRP_OFF,APLK_OFF
    '------------------------------------------------------------------------- 
    
    
    'Output PORTG.15 cant use that its for the bootloader mode !!
    
    
    Input  PORTF.12 'pin 40 RP108 U1RX
    Output PORTF.13 'pin 39 RP109 U1TX
    
    
    '----------U1  TX RX Setup  --------------------------------------------------
    
    
    U1MODEbits_STSEL = 0 '1 STOP BIT
    'U1MODEbits_PDSEL = 0 'NO Parity, 8 data COMPILER WONT RECOGNISE COMMAND
    U1MODEbits_ABAUD = 0
    U1MODEbits_brgh = 0
    
    
    U1BRG = 4 '37=115200'75=56700bps '(140mhZ / 115,200)/16 - 1 = 74.95 ~ 75 INTEGER
    
    
    'DECIDED NOT TO HAVE INTERRUPT DRIVEN TX FOR NOW MIGHT USE LATER TO OPTIMISE
    'u1sta.15 = 0 'interrupt after one tx character
    'u1sta.13 = 0 'is transmitted
    'IEC0bits_U1TXIE = 1 'enable tx interrupt
    
    
    u1modebits_uarten = 1 'enable uart
    U1STA.10 = 1 'Enable uart TX Bit 10 
    
    
    RPOR12 = 0                 'clears
    RPOR12 = %0000000000000001 ' pps output reg mapped u1tx pin 39
    
    
    RPINR18 = 0                'CLEARS
    RPINR18 = %0000000001101100 'pps output reg mapped U1RXPIN 40 
    
    
    Clear IEC0bits_U1RXIE 'clear U1 RX Interrupt
    Clear IFS0bits_U1RXIF 'clear U1 RX Interrupt flag                         
    Set IEC0bits_U1RXIE   'Set U1 RX Interrupt
    
    
    U1STA.7=0'0 interrupt is set when any character is recieved
    U1STA.6=0'x interrupt enabled when any character is recieved
    '-------- end of u1 tx and rx setup ----------------------------------
    
    
    '--------- u2 TX and RX setup ----------------------------------------
    Input  PORTD.14 'pin 47 RPI78 U2 RX   'RPI78 not RP178!!!!!
    Output PORTD.15 'pin 48 RP79 U2 TX
    
    
    U2MODEbits_STSEL = 0 '1 STOP BIT
    'U2MODEbits_PDSEL = 0 'NO Parity, 8 data COMPILER WONT RECOGNISE COMMAND
    U2MODEbits_ABAUD = 0
    U2MODEbits_brgh = 0
    
    
    U2BRG = 4'37 '37=115200'75=56700bps '(140mhZ / 115,200)/16 - 1 = 74.95 ~ 75 INTEGER
    
    
    'DECIDED NOT TO HAVE INTERRUPT DRIVEN TX FOR NOW MIGHT USE LATER TO OPTIMISE
    'u2sta.15 = 0 'interrupt after one tx character
    'u2sta.13 = 0 'is transmitted
    'IEC0bits_U2TXIE = 1 'enable tx interrupt
    
    
    u2modebits_uarten = 1 'enable uart
    U2STA.10 = 1 'Enable uart TX Bit 10 
    
    
    RPOR4 = 0                 'clears
    RPOR4 = %0000000000000011 ' pps output reg mapped u2tx pin 48
    
    
    RPINR19 = 0                'CLEARS
    RPINR19 = %0000000001001110'pps input reg mapped U1RXPIN 40 
    
    
    Clear IEC1bits_U2RXIE 'clear U1 RX Interrupt
    Clear IFS1bits_U2RXIF 'clear U1 RX Interrupt flag                         
    Set IEC1bits_U2RXIE   'Set U1 RX Interrupt
    
    
    U2STA.7=0'0 interrupt is set when any character is recieved
    U2STA.6=0'x interrupt enabled when any character is recieved
    '-------- end of U2 Tx and Rx setup ----------------------------------
    
    
    '''''''''''' U3 Tx and Rx Setup --------------------------------------
    Input  PORTG.0 'pin 90 RP112 U3 RX   '
    Output PORTG.1 'pin 89 RP113 U2 TX
    
    
    'U3MODEbits_STSEL = 0 '1 STOP BIT
    ''U2MODEbits_PDSEL = 0 'NO Parity, 8 data COMPILER WONT RECOGNISE COMMAND
    'U3MODEbits_ABAUD = 0
    'U3MODEbits_brgh = 0
    
    
    'U3BRG = 37'37 '37=115200'75=56700bps '(140mhZ / 115,200)/16 - 1 = 74.95 ~ 75 INTEGER
    
    
    'DECIDED NOT TO HAVE INTERRUPT DRIVEN TX FOR NOW MIGHT USE LATER TO OPTIMISE
    'u2sta.15 = 0 'interrupt after one tx character
    'u2sta.13 = 0 'is transmitted
    'IEC0bits_U2TXIE = 1 'enable tx interrupt
    
    
    'u3modebits_uarten = 1 'enable uart
    'U3STA.10 = 1 'Enable uart TX Bit 10 
    
    
    Declare Hserial3_Baud = 115200'9600
    Declare Hrsout3_Pin = PORTG.1
    Declare HRSin3_pin = PORTG.0
    
    
    
    
    RPOR13 = 0                 'clears
    RPOR13 = %0000000000011011 ' pps output reg mapped u3tx pin 89
    
    
    RPINR27 = 0                'CLEARS
    RPINR27 = %0000000001110000'pps input reg mapped U3RXPIN 90 
    
    
    'Clear IEC5bits_U3RXIE 'clear U1 RX Interrupt
    'Clear IFS5bits_U3RXIF 'clear U1 RX Interrupt flag                         
    'Set IEC5bits_U3RXIE   'Set U1 RX Interrupt
    
    
    'U3STA.7=0'0 interrupt is set when any character is recieved
    'U3STA.6=0'x interrupt enabled when any character is recieved
    
    
    '-------- end of U3 Tx and Rx setup ----------------------------------
    
    
    
    
    
    
    
    
    Output PORTG.13 'pin 97 Toggle pin see how fast MCU executes loop on scope
    
    
    
    
    '''''''''''' synchronise the 3 mcus with hardwired logic I/O Pins logical
    
    
    Input PORTD.13 'checks if other MCU has recieved ful packet
    Input PORTD.12 'checks if other MCU has recieved full packet
    
    
    Output PORTG.14 'tells other 2 mcus full valid packet recieved
    PORTG.14 = 0 'initially clear sync control
    
    
    '''''''''''' PWM SETUP ''''''''''''''''''''''''''''''''''''''''''''''''''''''
    
    
    ''' PTCON: PWM Time Base Control Register ''''''''''''''''''''''''''''''''''''
    PTCONbits_PTEN = 0 ' timer enable bit disable initially
    
    
    'Prescalar 1 : 8
    PTCON2 = %011 '011 = divide by 8
    
    
    'mode selection
    PWMCON1 = $0000 'PTPER holds period count of pwm
    
    
    'independent mode enable
    IOCON1 = $CC00  'fig 14-35 of pwm manual
            '$CC00 = PENH high, PENL high, PMOD: = 11 true independednt pwm o/p 
    
    
    ''''' PTPER: pwm timebase period register
    PTPER = 3500 'period value bits 3500 = 5.00 Khz frequency
    
    
    PTCONbits_PTEN = 1 'enable pwm
    
    
    PDC1 = 2000 ' 60 % duty cycle
                ' works perfectly get nice solid square wave 
                'duty is set by PDC1 0-3000 =0-100% Duty Cycle 
    '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    
    
    
    
    ''''''''''''' A/D convertor setup '''''''''''''''''''''''''''''''''''''''''''
    'trisb.0 = 1 'input an0
    'Declare Adin_Tad = c128_FOSC 'FOSC / 128
    'Declare Adin_Stime = 100 '10 us
    'Include "ADin.inc" 'load the ADin replacement routines into the program
    'Dim MyResult As Word
    'AD1CON2 = 0 ' Avdd, Avss, MUX A Only
    'ANSELB = %0000000000000001 'ANO on port b  
    '
    ' from microchip 33E A/D Reference Manual
    ' Manual conversion and manual sample page DS70621c-page 16-20
    
    
    
    
    'set port configuration
     ANSELA = $0000
     ANSELB = $0000
     ANSELC = $0000
     ANSELD = $0000
     ANSELE = $0000 
     ANSELG = $0000
     ANSELBbits_ANSB5 = 1'AN5 on portb.5 pin 20
     '
     'initialise and enable adc module
     AD1CON1 = $0000
     AD1CON2 = $0000
     AD1CON3 = $000F
     AD1CON4 = $0000
     AD1CHS0 = $0005
     AD1CHS123 = $0000
     AD1CSSH = $0000
     AD1CSSL = $0000
     AD1con1bits_ADON = 1
     ad1con1Bits_ad12b  = 1 'set for 12 bit mode
     
     DelayUS 20
       
    '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    
    
    Dim a As Float 'float var1
    a = 1000
    Dim b As Float 'float var2
    b = 10000
    Dim c As Float 'float var3
    c = 100000
    
    
    Dim loop As Byte 'floating point repeat loop pointer
    loop = 0
    
    
    Dim d As Word 'test variable
    d = 1000
    
    
    Dim REC As Byte 'char recieved U1 Rx Interrupt    
    REC = 0
    
    
    Dim REC1 As Byte 'char recieved U2 Rx Interrupt
    REC1 = 0
    
    
    Dim my_demand As Word 'word1
    my_demand = 1000
    Dim my_demandA As Word 'word1
    my_demandA = 0
    Dim my_demandB As Word 'word1
    my_demandB = 0
    
    
    
    
    Dim my_feedback As Word 'word2
    my_feedback = 2000
    Dim my_feedbackA As Word 'word2
    my_feedbackA = 0
    Dim my_feedbackB As Word 'word2
    my_feedbackB = 0
    
    
    
    
    Dim my_error As Word   'word3
    my_error = 3000
    Dim my_errorA As Word   'word3
    my_errorA = 0
    Dim my_errorB As Word   'word3
    my_errorB = 0
    
    
    
    
    Dim my_current1 As Word 'word4
    my_current1 = 4000
    Dim my_current1A As Word 'word4
    my_current1A = 0
    Dim my_current1B As Word 'word4
    my_current1B = 0
    
    
    
    
    
    
    
    
    Dim my_current2 As Word 'word5
    my_current2 = 5000
    Dim my_current2A As Word 'word5
    my_current2A = 0
    Dim my_current2B As Word 'word5
    my_current2B = 0
    
    
    
    
      
    Dim loop1 As Byte
    loop1 = 0
                 
    Dim intout [13] As Byte
    
    
    Dim bufcount As Byte
    bufcount = 0
    
    
    Dim bufcount2 As Byte
    bufcount2 = 0
    
    
    Dim tx1 [13] As Byte
    Dim tx2 [13] As Byte
    
    
    Dim sendrecieved As Dword
    sendrecieved = 0
    
    
    'timer1 initialise stolen from a c program I wrote for 33fj32gp202
    T1CONbits_TON = 0';
    T1CONbits_TCS=0';
    T1CONbits_TGATE =0';
    'T1CONbits_TCKPS = 0b00';
    TMR1=0x00';
    PR1 = 297'250'1000'; '// PIR settings  PIR = 500 was 8uS /PIR = 1600 was 25uS /PIR = 65000 was 1ms
    '//IPC1bits.T1IP = 0x01;
    '//IFS0bits.T1IF = 0;
    IEC0bits_T1IE = 1';
    'T1CONbits_TON = 1';
    
    
    'timer0 initialise stolen from a c program I wrote for 33fj32gp202
    T2CONbits_TON = 0';
    T2CONbits_TCS=0';
    T2CONbits_TGATE =0';
    'T1CONbits_TCKPS = 0b00';
    TMR2=0x00';
    PR2 = 27000'18000'300'1000'; '// PIR settings  PIR = 500 was 8uS /PIR = 1600 was 25uS /PIR = 65000 was 1ms
    '//IPC1bits.T1IP = 0x01;
    '//IFS0bits.T1IF = 0;
    IEC0bits_T2IE = 1';
    'T2CONbits_TON = 1';
    ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    
    
    
    
    
    
    
    
    Dim flag As Byte
    flag = 0
    
    
    Dim gotdata As Byte
    gotdata = 0
    
    
    Dim flag2 As Byte
    flag2 = 0
    
    
    Dim reading As Word
    reading = 0
    
    
    
    
    Main:
    
    
    ''''''''''''''''''''''coms to hyper terminal to show characters recieved
    Inc sendrecieved
    Select sendrecieved
    Case 100
    my_demandA.LowByte = tx1[1]
    my_demandA.HighByte = tx1[2]
    my_demandB.LowByte = tx2[1]
    my_demandB.HighByte = tx2[2]
    'HRSOut3 Dec my_demandA,13
    'HRSOut3 Dec my_demandB,13
    
    
    '***** A/D Conversio 12 bits channle AN5 portb.5 pin 20 of 100 pins
    
    
    AD1CON1bits_SAMP = 1 'start sampling
    DelayUS 10           'allows a 10uS Sampling time
    AD1con1bits_samp = 0 'start the conversion
    holdAN0:
    If AD1CON1bits_DONE = 1 Then ' 1  if adc not busy
    reading = ADC1BUF0 'grabs a/d converted value
    Else 'adc is still busy converting
    GoTo holdAN0 'try again
    EndIf
    HRSOut3 Dec reading,13 'sendout 0-4095 for 0- 3.3v 12 bits resoloution
    Case 200
    my_feedbackA.LowByte = tx1[3]
    my_feedbackA.HighByte = tx1[4]
    my_feedbackB.LowByte = tx2[3]
    my_feedbackB.HighByte = tx2[4]
    'HRSOut3 Dec my_feedbackA,13
    'HRSOut3 Dec my_feedbackB,13
    Case 300
    my_errorA.LowByte = tx1[5]
    my_errorA.HighByte = tx1[6]
    my_errorB.LowByte = tx2[5]
    my_errorB.HighByte = tx2[6]
    'HRSOut3 Dec my_errorA,13
    'HRSOut3 Dec my_errorB,13
    Case 400
    my_current1A.LowByte = tx1[7]
    my_current1A.HighByte = tx1[8] 
    my_current1B.LowByte = tx2[7]
    my_current1B.HighByte = tx2[8]
    'HRSOut3 Dec my_current1A,13
    'HRSOut3 Dec my_current1B,13
    Case 500
    my_current2A.LowByte = tx1[9]
    my_current2A.HighByte = tx1[10]
    my_current2B.LowByte = tx2[9]
    my_current2B.HighByte = tx2[10]
    'HRSOut3 Dec my_current2A,13
    'HRSOut3 Dec my_current2B,13,13
    sendrecieved = 0
    'clear the variables so if rx / tx wires come loose data vanishes
    tx1[1] = 0
    tx1[2] = 0
    tx2[1] = 0
    tx2[2] = 0
    tx1[3] = 0
    tx1[4] = 0
    tx2[3] = 0
    tx2[4] = 0
    tx1[5] = 0
    tx1[6] = 0
    tx2[5] = 0
    tx2[6] = 0
    tx1[7] = 0
    tx1[8] = 0
    tx2[7] = 0
    tx2[8] = 0
    tx1[9] = 0
    tx1[10] = 0
    tx2[9] = 0
    tx2[10] = 0
    sendrecieved = 0
    EndSelect 'end of case select
    
    
    '__________________________________________________________________
    'now this is all commented out
    'this was used to see how fast 33E can crunch 400 floating point 
    'calculations took  0.5ms on 33E clocked at 140Mhz
    '             took  6ms on 18f clocked at 40Mhz
    '             ball park 12 times faster than 18F 
        'portg.13 = 1
        'For loop = 0 To 100 'do 4 CPU Intensive floating point operations  
        'a = b * c      '1st floating point calcs
        'b = a * 1000   '2nd
        'c = b / 100000 '3rd
        'c = a * 10     '4th
        'Next loop
        'portg.13 = 0
    '_____________________________________________________________________    
    
    
    
    
    'loads up the data to be transmitted to the other two mcu's
    intout[0]= my_demand.LowByte '1000
    intout[1]= my_demand.HighByte
    intout[2]= my_feedback.LowByte '2000
    intout[3]= my_feedback.HighByte
    intout[4]= my_error.LowByte    '3000
    intout[5]= my_error.HighByte
    intout[6]= my_current1.LowByte '4000
    intout[7]= my_current1.HighByte
    intout[8]= my_current2.LowByte  '5000
    intout[9]= my_current2.HighByte
    intout[10]=$AA                  'end of data packet marker $AA = 10101010
    '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    
    
    
    
    '''''''''''''transmits the 22 bytes of data via charout subroutine ''''''''''''''
    
    
    T2CONbits_TON = 1' starts 250uS timer 2 which synchronises allthree mcus
    
    
    'transmits the data
    
    
    PORTG.13 = 1
    For loop = 0 To 10 'tx 22 bytes ,5 words to UTX1 5 words UTX2 + end of packets
    GoSub charout      'sub routine to transmit tx1 and tx2 bytes
    Next loop1         'repeats the transmit subroutine 10 times 
    PORTG.13 = 0
    
    
    hold:
    'has valid data been recieved from the other two MCU's
    
    
    If tx1 [11] = $AA And tx2 [11] = $AA Then
    'start 1ms timer
    PR1 = 297 'prescallar & 1.0ms interrupt
    T1CONbits_TON = 1' 'starts 1ms timer
    Else
    'no tx1[11] and tx2[11] not equal $AA data not recieved
        If flag2 = 1 Then 'has tmr 2 expired
        PR1 = 360'360 ' prescalar @ 1.1ms interupt
        t1conbits_TON = 1 'start 1ms timer data not recieved
        flag2 = 0         '
        Else              'otherwise
        GoTo hold         'check data has arived next loop until tmr2 expires
        EndIf             '
    EndIf
    
    
    
    
    hold1:
        If flag = 1 Then '1ms passed
        flag = 0
        tx1[11] = 0
        tx2[11] = 0
    Else
    GoTo hold1
    EndIf
        
    GoTo Main
    
    
    '----------------------------------------------------------------------------
    charout: 'Fast TX Routine to transmit data to the other 2 Processors
    
    
    If U1STA.9 = 1 Then 'if U1 Transmit buffer is full wait 
    GoTo charout:
    Else                'otherwise U1 Transmitt buffer is empty send next byte
    U1TXREG = intout [loop]
    EndIf
    
    
    holdTX2:
    If U2STA.9 = 1 Then  'if U2 Transmitt buffer is full wait
    GoTo holdTX2
    Else                'otherwise u2 transmitt buffer is empty send next byte
    U2TXREG = intout [loop] 
    EndIf
    
    
    Return 'exits txout function back to main prog
    '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    
    
    
    
    
    
    '''''''''''''''''''''''interrupts for individual sources ''''''''''''''''''''
    Isr U1RXInterrupt
        Inc bufcount
        'If bufcount= 11 Then bufcount = 1 'resets counter next packet of 10 bytes arrived
        tx1[bufcount] = U1RXREG
        If tx1[bufcount] = $AA Then bufcount = 0 
    Clear IFS0bits_U1RXIF
    EndIsr
    '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    Isr U2RXInterrupt
        Inc bufcount2
        'If bufcount2 = 11 Then bufcount2 = 1
        tx2 [bufcount2] = U2RXREG
        If tx2[bufcount2] = $AA Then bufcount2 = 0
    Clear IFS1bits_U2RXIF
    EndIsr
    '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    Isr U3RXInterrupt
        REC = U3RXREG
    Clear IFS5bits_U3RXIF
    EndIsr
    '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    Isr T1Interrupt
    'Toggle portg.13
    Clear IFS0bits_T1IF
    flag = 1
    EndIsr
    '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    Isr T2Interrupt
    'Toggle portg.13
    Clear IFS0bits_T2IF
    flag2 = 1
    EndIsr
    
    
    
    
    '''''''''''''''not used'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    'ISR U1TXInterrupt 'this can be used in future to optimes tx speed
    'Clear IFS0bits_u1txif
    'u1txreg = rec
    'endisr
    Next week I will develop this further
    I will make it position a large motor with a 4 quadrant H Bridge PCB circuit

    More will follow next week etc but for now I need a break for the weekend my brain hurts

    Thanks Matty

  • Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  • #6
    Prolific Poster pic-ignorant's Avatar
    Join Date
    Oct 2007
    Posts
    2,938
    Thumbs Up
    Received: 25
    Given: 31
    Total Downloaded
    926.61 MB

    0 Not allowed!

    Default Re: 33EP512MU810 Tripple Processor System Working well Communicates at 920Kb+

    Sounds like you're having fun Matty!
    Thanks for the link to the boards, I've just ordered some. I've struggled to find a simple solution for DSPIC33 series.
    Regards
    John

  • Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  • #7
    Member matty's Avatar
    Join Date
    Dec 2003
    Posts
    119
    Thumbs Up
    Received: 8
    Given: 3
    Total Downloaded
    303.76 MB

    0 Not allowed!

    Default Re: 33EP512MU810 Tripple Processor System Working well Communicates at 920Kb+

    Dear john I'm glad you have ordered some I hope you ordered the 33ep512mu810 version ? There is a few pics you can choose on that same development mcu board if you ordered same 33ep512mu810 mcu so we can compare notes on our projects. If you email the ebay seller he is very helpful and will tell you how to get the microchip pc application to use the sub boot loader. They take a couple of weeks to arrive as they from abroad. Please let me know how you get on and keep me posted. I will post more info next week as my project evolves..... Cheers Matthew

  • Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  • #8
    Prolific Poster pic-ignorant's Avatar
    Join Date
    Oct 2007
    Posts
    2,938
    Thumbs Up
    Received: 25
    Given: 31
    Total Downloaded
    926.61 MB

    0 Not allowed!

    Default Re: 33EP512MU810 Tripple Processor System Working well Communicates at 920Kb+

    Hi Matty,
    I got the boards. What are you using to program them? I haven't managed to get my Pickit 3 to communicate with it using the Standalone GUI or in MPLAB. I did download a Microchip Bootloader that seems to work though.

    Regards
    John

  • Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  • #9
    Member matty's Avatar
    Join Date
    Dec 2003
    Posts
    119
    Thumbs Up
    Received: 8
    Given: 3
    Total Downloaded
    303.76 MB

    1 Not allowed!

    Default Re: 33EP512MU810 Tripple Processor System Working well Communicates at 920Kb+

    Dear John

    which MCU did you porchase on the snad pic development board was it the 33EP512MU810 mcu the same as myne?

    I have not yet tried to program the board with the pic kit kit3 as the boot loader worked so well

    go to microhips website and downlaod the zip file

    "dsPIC33E_dspic24E_Bootloader_10182011 . zip" zip file

    exract the file and there is a folder called pc application

    Run the PC application and check the button for USB comport

    then on the snad pic board Hold down the reset button then while holding the button down press the reset the bootloader button button on rg.15 then let go of both buttons
    the pc will go bing bong usb device recognised

    then click on the connect button and the boot loader pc app recognises the board

    then click on load lad hex file choose the compiled hex file you have made then it loads up
    then click erase program verify button and the pc application downlads the hex file to your snad pic board its that easy

    let me know if it works

    of course you can program again and again as the 33EP512MU10 has a seperate area of flash memory dedicated to the usb bootloader which comes pre programed on the device when it is shipped

    let me know if you can program the device using the above description

    Hope this helps regards matthew

  • Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  • #10
    Prolific Poster pic-ignorant's Avatar
    Join Date
    Oct 2007
    Posts
    2,938
    Thumbs Up
    Received: 25
    Given: 31
    Total Downloaded
    926.61 MB

    0 Not allowed!

    Default Re: 33EP512MU810 Tripple Processor System Working well Communicates at 920Kb+

    Thanks Matty,
    That's the same bootloader I used. (Which works) I'll try again with the Pickit 3 over the weekend. It would be useful to be able to reflash the bootloader if required

    Regards
    John

  • Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  • #11
    Prolific Poster pic-ignorant's Avatar
    Join Date
    Oct 2007
    Posts
    2,938
    Thumbs Up
    Received: 25
    Given: 31
    Total Downloaded
    926.61 MB

    0 Not allowed!

    Default Re: 33EP512MU810 Tripple Processor System Working well Communicates at 920Kb+

    Does your bootloader program crash Matty? Maybe it's just my laptop, but mine crashes a lot, and I have to stop the process in windows and restart it.

    Rgds
    John

  • Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  • #12
    Prolific Poster pic-ignorant's Avatar
    Join Date
    Oct 2007
    Posts
    2,938
    Thumbs Up
    Received: 25
    Given: 31
    Total Downloaded
    926.61 MB

    0 Not allowed!

    Default Re: 33EP512MU810 Tripple Processor System Working well Communicates at 920Kb+

    All working now. I have 2 hid boot loaders, the one I was having problems with is the MLA bootloader. The other one is fine
    Thanks Matty!

  • Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

    Thread Information

    Users Browsing this Thread

    There are currently 1 users browsing this thread. (0 members and 1 guests)

       

    Similar Threads

    1. Replies: 7
      Last Post: 4th December 2017, 10:24
    2. Replies: 29
      Last Post: 19th May 2017, 18:51
    3. Replies: 3
      Last Post: 29th April 2016, 09:19
    4. Tripple Processer System Fast Communications Between 3 MCU's
      By matty in forum Proton Plus Compiler v3
      Replies: 17
      Last Post: 13th April 2016, 13:32
    5. Tripple source Interrupt
      By Peter Truman in forum Proton Plus Compiler v3
      Replies: 16
      Last Post: 31st May 2015, 00:05

    Tags for this Thread

    Posting Permissions

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