Search the Community

Showing results for tags 'timer'.

More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • News
    • New Users Introduction
    • Announcements
  • Digilent Technical Forums
    • FPGA
    • Digilent Microcontroller Boards
    • Non-Digilent Microcontrollers
    • Add-on Boards
    • Scopes & Instruments and the WaveForms software
    • LabVIEW
    • FRC
    • Other
  • General Discussion
    • Project Vault
    • Learn
    • Suggestions & Feedback
    • Buy, Sell, Trade
    • Sales Questions
    • Off Topic
    • Educators
    • Technical Based Off-Topic Discussions

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start





Website URL







Found 4 results

  1. Hello guys, I am using Zybo Z7-10 and want to use a timer which polls e.g. every 100ms by starting a task in freertos. What is the best way to implement such timer? Do I need to use XScu_Timer or Global Timer or Watchdog Timer Thanks, Mirco
  2. Hello all. I have some misunderstanding with TTCs on zynq-7000. I used this guide to understand how TTCs are working, but seems like a quite subtlety which I don't understand. I have to use 2 TTCs with PWM (match value) and change RC in handlers to make CNC. After trying to make it like get new RC in handler and change RC I got unstable error for about 0.5s for 25s of changing RC and some impulses haven't generated but handler was called instantly after changing RC (I took into account that (RC - match value) should be greater then 0). I thought it can be because I have to: 1) reduce time we waste in handler (some code fragments like change RC made by asm); 2) consider some information we lose when we shift RC to prescaler; 3) consider counter of my timer because there are sometimes another handlers or something; 4) when we change RC we should reset counter (special bit in XTTCPS_CNT_CNTRL register); 5) see if RC is less then counter - make RC as match value (never happens). After this manipulations I saw that my timers with same amount RC (before counter compensation) ends in different time (I used different counters so timers have different number of RC). Can someone help me? P.S. I tried to use inline functions with asm() to change RC. Universal (by transmit using timer number) and 2 different functions with same (different only address to timer) asm code, and I got different results. I don't understand why. Thanks!
  3. I'm using Arduino 1.6.9 with ChipKIT core and a DP32 rev B. My code sets up an interrupt for timer 3. When I set the prescaler to 1:32 or less, the interrupt runs just fine (although with some quirky behavior that I'll explain below). However, when I set the prescaler to 1:64 or 1:256, the interrupt appears to fail. My code is included below but I'll provide a brief explanation of its function here. The ISR increments a count variable, and sets a flag variable to high. The loop checks to see if the flag is high. If it is, it toggles LEDs 1, 2 and 3 to represent bits 5, 6, and 7 (respectively, with bit 0 as the LSB) of the count variable. LED 1 is toggled to represent the flag variable, so if the flag is high the LED is turned on, and it is turned off if the flag is low. The behavior I am getting with the prescaler set to 1:32 is as expected. LED 4 glows dimly, while LEDs 1 through 3 count rapidly upward in binary. However, when the prescaler is set to 1:64, LED 1 (bit 5 LED) is toggled on, and remains, while the rest of the LEDs are off. This includes LED 4 (the flag LED) which leads me to believe that the flag is not being raised. As for how or why LED 1 gets toggled on, I have no idea. I also mentioned some unusual behavior earlier. The the function that sets my timer accepts a desired interrupt frequency, and accounts for the prescaler when calculating the period needed to achieve this frequency. This means that the interrupt frequency should not vary much between different prescaler values. However, when I set my prescaler to 1:16, and my interrupt frequency to 40 Hz, the actual interrupt frequency is slower than when I set my prescaler to 1:32 (with an interrupt frequency of 40 Hz). In fact, prescaler 1:32 is so much faster that I cannot make out the individual LED flashes for any of my indicator LEDs. What's more, the LEDs are running much faster than they should. With prescaler set to 1:32, and interrupt frequency set to 20 Hz, the frequency on the LED 1 (tied, as you recall, to bit 5 of my counter) should be 0.625 Hz (that is, 20 Hz / 2^4). In practice, however, it switches much faster than this. Can anybody tell me what's going wrong? I feel like I'm probably missing something simple and obvious, or just overlooking something regarding the operation of timers. TL;DR Code below: /*************************************************************** * Define some constants ***************************************************************/ #define CLOCK_FREQ 40000000 #define T3CON_ENABLE_BIT 0x8000 #define T3_SOURCE_INT 0 // Prescaler values // Don't change these. Set the prescaler below using these. #define T3_PRESCALE_1_1 0 #define T3_PRESCALE_1_2 1 #define T3_PRESCALE_1_4 2 #define T3_PRESCALE_1_8 3 #define T3_PRESCALE_1_16 4 #define T3_PRESCALE_1_32 5 #define T3_PRESCALE_1_64 6 #define T3_PRESCALE_1_256 7 // This was originally going to test a /*************************************************************** * Set our prescaler ***************************************************************/ #define PRESCALE T3_PRESCALE_1_32 /*************************************************************** * Various Variables ***************************************************************/ volatile uint32_t count = 0; volatile unsigned int flag = 0; int mask = 0; /*************************************************************** * ISR ***************************************************************/ void __attribute__((interrupt)) myISR() { count++; flag = 1; clearIntFlag(_TIMER_3_IRQ); } /*************************************************************** * Timer and interrupt setup function ***************************************************************/ void start_timer_3(uint32_t frequency) { uint32_t period; period = CLOCK_FREQ / (2^PRESCALE * frequency); // This formula isn't correct for prescaler 1:256 T3CONCLR = T3CON_ENABLE_BIT; // Turn the timer off T3CON = PRESCALE; // Set the prescaler TMR3 = 0; // Clear the counter PR3 = period; // Set the period T3CONSET = T3CON_ENABLE_BIT; // Turn the timer on } /*************************************************************** * Setup ***************************************************************/ void setup() { start_timer_3(20); setIntVector(_TIMER_3_VECTOR, myISR); setIntPriority(_TIMER_3_VECTOR, 4, 0); clearIntFlag(_TIMER_3_IRQ); setIntEnable(_TIMER_3_IRQ); pinMode(PIN_LED1, OUTPUT); pinMode(PIN_LED2, OUTPUT); pinMode(PIN_LED3, OUTPUT); pinMode(PIN_LED4, OUTPUT); } /*************************************************************** * Loop ***************************************************************/ void loop() { if (flag) { digitalWrite(PIN_LED4, HIGH); if (count & 0b000100000) digitalWrite(PIN_LED1, HIGH); else digitalWrite(PIN_LED1, LOW); if (count & 0b001000000) digitalWrite(PIN_LED2, HIGH); else digitalWrite(PIN_LED2, LOW); if (count & 0b010000000) digitalWrite(PIN_LED3, HIGH); else digitalWrite(PIN_LED3, LOW); flag = 0; } else digitalWrite(PIN_LED4, LOW); }
  4. Hello Guys! I hope you can help me with some doubts. I have a code that I use the ADC, TIMER and ETHERNET modules, when I try to compile it some erros are reported, as follows: C:/Users/MyName/Desktop/mpide-0023-windows-20140821/hardware/pic32/compiler/pic32-tools/bin/../lib/gcc/pic32mx/4.5.2/../../../../pic32mx/bin/ld.exe: small-data section exceeds 64KB; lower small-data size limit (see option -G) chipKITEthernet\utility\DNS.c.o: In function `DNSEndUsage': C:/Users/MyName/Documents/mpide/libraries/chipKITEthernet/utility/DNS.c:208:(.text.DNSEndUsage+0x0): relocation truncated to fit: R_MIPS_GPREL16 against `no symbol' C:/Users/MyName/Documents/mpide/libraries/chipKITEthernet/utility/DNS.c:211:(.text.DNSEndUsage+0x20): relocation truncated to fit: R_MIPS_GPREL16 against `no symbol' C:/Users/MyName/Documents/mpide/libraries/chipKITEthernet/utility/DNS.c:213:(.text.DNSEndUsage+0x38): relocation truncated to fit: R_MIPS_GPREL16 against `no symbol' chipKITEthernet\utility\DNS.c.o: In function `DNSResolve': C:/Users/MyName/Documents/mpide/libraries/chipKITEthernet/utility/DNS.c:262:(.text.DNSResolve+0x48): relocation truncated to fit: R_MIPS_GPREL16 against `no symbol' C:/Users/MyName/Documents/mpide/libraries/chipKITEthernet/utility/DNS.c:256:(.text.DNSResolve+0x74): relocation truncated to fit: R_MIPS_GPREL16 against `no symbol' chipKITEthernet\utility\DNS.c.o: In function `DNSIsResolved': C:/Users/MyName/Documents/mpide/libraries/chipKITEthernet/utility/DNS.c:358:(.text.DNSIsResolved+0x0): relocation truncated to fit: R_MIPS_GPREL16 against `no symbol' C:/Users/MyName/Documents/mpide/libraries/chipKITEthernet/utility/DNS.c:369:(.text.DNSIsResolved+0xac): relocation truncated to fit: R_MIPS_GPREL16 against `no symbol' C:/Users/MyName/Documents/mpide/libraries/chipKITEthernet/utility/DNS.c:380:(.text.DNSIsResolved+0xfc): relocation truncated to fit: R_MIPS_GPREL16 against `no symbol' C:/Users/MyName/Documents/mpide/libraries/chipKITEthernet/utility/DNS.c:384:(.text.DNSIsResolved+0x114): relocation truncated to fit: R_MIPS_GPREL16 against `no symbol' C:/Users/MyName/Documents/mpide/libraries/chipKITEthernet/utility/DNS.c:388:(.text.DNSIsResolved+0x124): relocation truncated to fit: R_MIPS_GPREL16 against `no symbol' C:/Users/MyName/Documents/mpide/libraries/chipKITEthernet/utility/DNS.c:423:(.text.DNSIsResolved+0x1f4): additional relocation overflows omitted from the output collect2: ld returned 1 exit status I'm using the timer with interruption enabled, the ADC is used to scan 6 chs and the Ethernet to send the data to my computer, somebody coud help me? Regards.