Electronic Circuits and Projects Forum



Force Overlap

12 Last »
  1. #1
    AtomSoft AtomSoft is offline

    Force Overlap

    Im planning on using USB MSD and also need a huge buffer for when USB isnt used...

    If i power the Device VIA USB CABLE then i want to use the USB Buffer for USB MSD STUFF
    if i power the device VIA external POWER then i want to use the USB buffer for something else...

    How can i create another variable to overlap on USB MSD buffer space ?
    My Site
    AtomSoftTech: C18 TIPS & TRICKS v9 PDF

    My Name: Jason Lopez
    My Store: SHOP
    My eBay Store: eBay!
    My Forum: Forum

  2. Thread Starter #2
    AtomSoft AtomSoft is offline
    Im seriously starting to really dislike Microchip PICs.... Linker Files and the such... then NEAR/FAR omg...
    0
    My Site
    AtomSoftTech: C18 TIPS & TRICKS v9 PDF

    My Name: Jason Lopez
    My Store: SHOP
    My eBay Store: eBay!
    My Forum: Forum

  3. #3
    Gobbledok Gobbledok is offline
    On PIC32's, I have used malloc() and free() to allocate and free large variables.

    Not sure whether it is available or worth it for your PIC, though.
    0
    Last edited by Gobbledok; 1st February 2012 at 11:00 PM.
    There are 10 types of people in this world: Those who understand binary and those who don't.

    If it wasn't for Thomas Edison, we'd be all watching TV by candlelight.

  4. #4
    nsaspook nsaspook is online now
    Quote Originally Posted by AtomSoft View Post
    Im planning on using USB MSD and also need a huge buffer for when USB isnt used...

    If i power the Device VIA USB CABLE then i want to use the USB Buffer for USB MSD STUFF
    if i power the device VIA external POWER then i want to use the USB buffer for something else...

    How can i create another variable to overlap on USB MSD buffer space ?
    If you mean the 512 byte dataBuffer/FATBuffer. The easiest way to use it would be to create a struture type for your data, create a pointer of that data stucture type and assign the address of the buffer memory you want to use to that pointer. I have not looked at the MSD code but I would guess if you don't use the functions it's internal data buffer memory location should still be free to read or write by other processes.
    0
    My comments are my own and don't represent the views of any company.
    In GOD we trust, all others we monitor.

  5. Thread Starter #5
    AtomSoft AtomSoft is offline
    ok having enough space isnt the issue i found out... what could cause this problem with SPRINTF ?



    Code :
            while(1) //FOREVER LOOP
            {
                getstr_uart(Rxdata,5); //GET 5 CHARACTERS ... WORKS as you can see in image
                memset(TxStr,0,20);    //Clears the buffer (works)
     
                sprintf(TxStr, "Hello %s!\n\r\0",Rxdata); //[B] THIS SETS THE ENTIRE BUFFER TO 0xFF [/B]
     
                str2uart(TxStr); //Usually works but jumps out and turns on some leds for some reason... 
            }
    Attached Images
    0
    Last edited by AtomSoft; 2nd February 2012 at 02:35 AM.
    My Site
    AtomSoftTech: C18 TIPS & TRICKS v9 PDF

    My Name: Jason Lopez
    My Store: SHOP
    My eBay Store: eBay!
    My Forum: Forum

  6. #6
    nsaspook nsaspook is online now
    Is 0xDDC (the location of TXStr) a valid data memory address on your chip?
    0
    My comments are my own and don't represent the views of any company.
    In GOD we trust, all others we monitor.

  7. Thread Starter #7
    AtomSoft AtomSoft is offline
    Quote Originally Posted by nsaspook View Post
    Is 0xDDC (the location of TXStr) a valid data memory address on your chip?
    Technically yes... but its clasisfied as USB VARS so im trying to this now:

    Code :
    #pragma udata vars
    unsigned char TxStr[20];
    unsigned char Rxdata[6]={0};
    unsigned char Txdata[] = "UART Operational!\n\r\0";
    #pragma udata

    where vars is GPR1 aka 0x100 to 0x1FF but still i get the same issue... you can see the address changed but all 0xFF still.

    Attached Images
    0
    My Site
    AtomSoftTech: C18 TIPS & TRICKS v9 PDF

    My Name: Jason Lopez
    My Store: SHOP
    My eBay Store: eBay!
    My Forum: Forum

  8. #8
    Ian Rogers Ian Rogers is online now
    Super Moderator
    What happens without the memset(); command?... I'm just wondering if the function is some how changing the pointer to a rom pointer. as that would cause this effect..
    0
    I'd give my left arm to be ambidextrous
    Nigel's tutorials in asm... http://www.winpicprog.co.uk/
    Nigel's tutorials.. re-written in C. http://www.electro-tech-online.com/c...torials-c.html

  9. Thread Starter #9
    AtomSoft AtomSoft is offline
    Same exact thing without the memset() command.... The only good thing ive done is setup the Linker so its in a good location of memory heh



    Tried it like:

    &TxStr and TxStr no luck...
    Attached Images
    0
    Last edited by AtomSoft; 2nd February 2012 at 02:34 PM.
    My Site
    AtomSoftTech: C18 TIPS & TRICKS v9 PDF

    My Name: Jason Lopez
    My Store: SHOP
    My eBay Store: eBay!
    My Forum: Forum

  10. #10
    Ian Rogers Ian Rogers is online now
    Super Moderator
    Just to see if sprintf requires a const rom pointer .... Go into program code and look at code position 0x100 and see if the code is 0xff ---> 0xff;
    0
    I'd give my left arm to be ambidextrous
    Nigel's tutorials in asm... http://www.winpicprog.co.uk/
    Nigel's tutorials.. re-written in C. http://www.electro-tech-online.com/c...torials-c.html

12 Last »
Tags
Similar Threads
Thread Starter Forum Replies Last Post
cadsoft eagle, force single layer glmclell General Electronics Chat 2 3rd August 2004, 02:57 AM
Voltage to dot graph,overlap problem Screech General Electronics Chat 11 9th March 2004, 03:10 AM
desperate! how to force mplab to erase pic program memory? huanyong Microcontrollers 8 9th October 2003, 01:35 AM
servo force feedback DirtyLude Robotics & Mechatronics 0 27th August 2003, 08:17 PM
I need a force sensor fraughton Electronic Projects Design/Ideas/Reviews 1 3rd February 2003, 07:38 PM
Electronic Circuits  |  Learning Electronics

Join our community with over 100,000 Members! It's free, easy and when you're logged in you have many more features! Click to register.
Page Time: 0.06302 seconds      Memory: 8,492 KB      Queries: 17      Templates: 0