Interrupt Driven Rotary Table controller

Discussion in 'Software and Programming' started by rodw, Nov 30, 2015.

Help Support HMEM by donating:

  1. Aug 4, 2019 #101

    rodw

    rodw

    rodw

    Well-Known Member

    Joined:
    Dec 3, 2012
    Messages:
    1,132
    Likes Received:
    334
    Did you uncomment the definition in LCD.h as per my instructions in Post#93? As far as I know the Sainsmart is identical to the DFRobot in relation to resistor values used.
    You should be able to create a new device in settings and define a linear device and swap between your brake and your rotary table.

    The menu options are there, take the time to fully explore each menu option. There is no need to change #defines in the code.
     
  2. Aug 4, 2019 #102

    MarkHar123

    MarkHar123

    MarkHar123

    New Member

    Joined:
    Sep 17, 2014
    Messages:
    4
    Likes Received:
    0
    Yes. I uncommented #definef and it made no difference.
     
  3. Aug 4, 2019 #103

    rodw

    rodw

    rodw

    Well-Known Member

    Joined:
    Dec 3, 2012
    Messages:
    1,132
    Likes Received:
    334
    Could try these LCD files instead of the ones provided earlier?
    DFROBOT is enabled
    It looks like I did not finish off the code so LCD.cpp was not selecting code based on the #define you uncommented and always used DFROBOT settings. Sounds like that is wrong for your screen..
    Tested on a DFRobot. If this does not work, comment the #define out again and try again
    If it still does not work, you need to compare your resistor values against the ones here
    https://www.dfrobot.com/product-51.html

    Once you have a keyboard working.,
    left arrow to <config>
    press down arrow
    To create a new device, from <config> left arrow to <Devices> press down arrow and add a new device (up arrow to yes and select).
    Devices are numbered from Zero
    Left arrow to get to <Setup> down Arrow to select.
    Find DevTyp option in this menu and set to Linear and select.
    Then configure your device and save it.

    If you get stuck, bump the CONFIG_VERSION up by 1. This will force the script to erase the EEPROM on the next startup but it can be erased from the device menu. We usuualy only need to do this if the globals structure changes.
     

    Attached Files:

  4. Aug 4, 2019 #104

    MarkHar123

    MarkHar123

    MarkHar123

    New Member

    Joined:
    Sep 17, 2014
    Messages:
    4
    Likes Received:
    0
    I think I'll take a break from this for awhile. I've spent hours trying to get this to work. I went back to version 10 of your software and installed the old Libraries to get the Rotary part working again. Has anybody used the Linear feature before?
     
  5. Aug 7, 2019 #105

    MarkHar123

    MarkHar123

    MarkHar123

    New Member

    Joined:
    Sep 17, 2014
    Messages:
    4
    Likes Received:
    0
    I am able to get into the setup parameters but can not change some of them for the Linear function. When I do get into the Setup parameters there are no numbers there for Dis/Rv, T/Rat and JgMM. I can cursor left and right but clicking Up and Down does nothing. Adds no numbers. Am I still doing something wrong here?
     
  6. Aug 13, 2019 #106

    stragenmitsuko

    stragenmitsuko

    stragenmitsuko

    Well-Known Member

    Joined:
    Jan 19, 2016
    Messages:
    213
    Likes Received:
    76
    A bit of feedback :

    RotaryTable11.zip downloaded from post#93 compiles and uploads as it should .
    I have made my dfrobot board sainsmart/freetronics compatible by modifying the hardware and all works as expected .
    The backlight pin is still dfrobot , and as expected does not work with the freetronics settings .
    Did not try the dfrobot settings as I no longer have a real dfrobot board .

    Then I downloaded the LCD11.zip and commented the define dfrobot .
    That gives me a compile error . Somthing like { expected .
    Did not persue this .

    To my knowledge sainsmart and freetronics use thesame resistor values , but sainsmart has a different backlight pin .
    Dfrobot has a 2K2 resistor instead of the 2K and thesame backlight pin as the sainsmart does .


    That aside , I mentioned a nano problem when writing to eeprom .
    I noticed when compiling and uploading the sketch :
    Uno : 28478 bytes ( 88%) of memory
    Nano : 28478 bytes (92%) of memory .
    Altough they both use thesame processor , something is different .
    I also have to set my nano to "old bootloader" otherwise it will not upload .
    But it does work .


    Pat
     
  7. Aug 14, 2019 #107

    rodw

    rodw

    rodw

    Well-Known Member

    Joined:
    Dec 3, 2012
    Messages:
    1,132
    Likes Received:
    334
    Ooops on line 353 of LCD.cpp, I should have deleted one more comment.
    It should read as per the second last line
    Code:
    #ifdef DFROBOT
    static uint8_t const buttonMappings[] PROGMEM = {
        2, 0, 3, 3, 0, 0, 0, 4, 4, 0, 0, 0, 1, 1, 0, 0,
        0, 0, 0, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
    };
    #else
    static unsigned char const buttonMappings[] PROGMEM = {
        2, 0, 0, 0, 3, 0, 0, 0, 0, 4, 4, 0, 0, 0, 0, 1,
        1, 0, 0, 0, 0, 0, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0
    };   // deleted the comment
    #endif
    
    These mappings are created with a utility in the original LCD library as mentioned earlier.

    Also the backlight pin should be able to be enabled on different hardware with a change to around line 31 (// = comment)
    Code:
    //#define LCD_BACK_LIGHT         3        // Default LCD backlight is on D3 - Freetronics
    #define LCD_BACK_LIGHT          10        // Default LCD backlight is on D3 - DFROBOT and others
    #define LCD_BUTTON_PIN          A0        // Button state is on A0
    
    So you just need to uncomment one line and recomment the other.

    And the memory usage of the nano is probably going to break the script due to memory overruns. The bootloader must be bigger.

    The bootloader is burnt to the chip using am Atmel Risp programmer. I have used one of these to download a script when I've busted the USB on an Arduino. There will be instructions around on how to do this and also how to make your own Risp programmer. This may increase available RAM as the bootloader is no longer there but I really don't know.

    And yes, most boards except Freetronics use the 2k2 resistor.
     

Share This Page