Recent Changes

Friday, August 10

  1. msg The code changes message posted The code changes Both connections means the Serial and the RS485 serial.
    The code changes
    Both connections means the Serial and the RS485 serial.
    10:18 am
  2. msg The code changes message posted The code changes By building the actual circuit using cheap RS485 bricks and two MicroPro I discover that: 1. Both …
    The code changes
    By building the actual circuit using cheap RS485 bricks and two MicroPro I discover that:
    1. Both connections needs to run at same Baud Rate (9600) in order to get good response from the remote unit.
    2. The 10ms delay included before setting the Master to receive mode makes to loose bytes from remote unit. After taking it out of the code makes the response more reliable.

    Still appreciate the all the work done in this WIKI. Thansk.
    10:16 am

Wednesday, June 6

  1. msg timer1 and analogwrite interference message posted timer1 and analogwrite interference Hi to everyone, my situation is the following: I have to generate a total of 6 pwm outputs on…
    timer1 and analogwrite interference
    Hi to everyone,

    my situation is the following:

    I have to generate a total of 6 pwm outputs on an arduino uno:

    -4 at high frequency
    for this i use pins 5 6 3 and 11 and the function analogwrite() to generate the pwm

    -2 at low frequency = 1Hz
    for this i use pins 9 and 10 and the function timer1.pwm() (library timerOne.h) to generate the pwm


    as i read in the forum somewhere, this board has three times, the timer1 should affect just pins 9 and 10 so i should not have interference between timers.

    The problem:

    if i set a value higher than 0 to the slow frequency pwms i see also the other pwms to run at 1Hz.

    in the loop function i have created a procedure( adv.communication(); ) that allows to update the duty cycle of the pwms.

    here is the arduino code that i use:

    Code: [Select]

    #include<advantech2.h>
    advantech adv;


    void setup() {
    Serial.begin(115200);
    Serial.setTimeout(10);
    Timer1.initialize(1000000); 1000000 means 1Hz
    Timer1.attachInterrupt(callback);
    callback is calld every second

    }

    void loop() {
    int com=adv.communication(); allows to updare the values of the pwms D.C. stored in an array
    }

    void callback(){
    adv.update_all_outputs();
    every second the analogwrite() and timer1.pwm functions are called to update the pwm values stored in the array
    }


    The part of my library code in wich i update the pwms i the following:

    every channel is set up using

    pinMode(address[position][7],OUTPUT);

    but this is done in the loop(), not in the setup()


    Code: [Select]

    switch((int)address[position][6]){
    case 0:
    analogWrite((int)address[position][7],(int)(data_raw[position]*255.00/100.00));
    break;
    case 1:
    Timer1.pwm((int)address[position][7],(int)(data_raw[position]*1023.00/100.00));
    break;
    }


    - (int)address[position][6] is used to refear to the kind of pwm (slow =1 fast =0)
    - (int)address[position][7] is used to specify the pin number
    - data_raw[position] is the duty cycle value, float from 0 to 100

    at the beginning every duty cycle is set at 0.
    if i "turn on "( i mena i set a value of duty cycle greater than 0 only the fast pwms everything works fine, but as i "turn on" one of the slow pwms also the others start to run at the same frequency of 1Hz.

    i can't understand why...
    am i mistaking something?
    is there anything else that i have to set?
    should i make the same thing using timer 0 and timer 2 instead of the analogwrite function?

    thanks for reading,
    cheers

Monday, April 30

Sunday, April 29

  1. page RS485Info edited ... what they are called, what information they carry and even the connectors and pin numbers to …
    ...
    what they are called, what information they carry and
    even the connectors and pin numbers to use (see
    <span style="color: #990099;">[[http://www.windmill.co.uk/wiring.html]]</span> if[[http://www.windmill.co.uk/wiring.html%20|http://www.windmill.co.uk/wiring.html ]]if you are
    interested in details of the RS232 standard). RS422
    and RS485, by contrast, define only the electrical
    (view changes)
    6:58 pm

Wednesday, April 25

  1. page ArduinoPinCurrent edited ... Be Nice to your Arduino! (Thanks to @CrossRoads !) ... : {Atmel-42735-8-bit-AVR-Microcont…
    ...
    Be Nice to your Arduino!
    (Thanks to @CrossRoads !)
    ...
    : {Atmel-42735-8-bit-AVR-Microcontroller-ATmega328-328P_Datasheet.pdf}
    Official DataSheet for ATmega1280/2560 (MEGA etc.) : {Atmel-2549-8-bit-AVR-Microcontroller-ATmega640-1280-1281-2560-2561_datasheet.pdf}
    A Few Definitions:
    (view changes)
    4:28 pm

Tuesday, April 24

  1. page Kufy-TestTerry1 (deleted) edited
    8:18 am

Monday, April 23

Wednesday, April 18

  1. 2:22 pm

More