|
Handy system clock for AVR 8-bit microcontrollers suitable for measuring elapsed time or for use with timers. This provides The system clock is based around a 32kHz clock crystal and one of the 8-bit timers provided by the AVR, it is possible to use the CPU frequency as a timer base as long as it’s a nice, dividable, frequency. The AVR timer is a 8-bit register that simply counts at the rate of its clock source. The clock source can be either the CPU This example is creating a 1/32 second resolution timer (32 ticks per second) using an external 32768 Hz watch crystal. The following to equations can be used to calculate either comp or the prescale value.
Using 128 as the comp value and inserting the other values into equation 2 yields the following prescaler
So, a prescaler of 8 gives us two interrupts per 256 cycles, one at 128 and one at 256 (overflow). Using 256 as comp would yield a perscaler of 4 but the target device I used didn’t have a TS/4 prescaler. Complete source code for a 1/32 (or 31.25ms) second resolution timer for the ATmegaxx4 using Timer 2 and a 32kHz watch crystal connected to the pins TOSC1 and TOSC2. #include <avr/io.h> #include <avr/interrupt.h> typedef uint32_t clock_time_t; static clock_time_t global_system_ticks = 0; /* ISR for the timer overflow */ ISR(TIMER2_OVF_vect) { global_system_ticks++; } /* ISR for the comparator */ ISR(TIMER2_COMPA_vect) { global_system_ticks++; } /* Return number of elapsed ticks */ clock_time_t clock_time() { return (global_system_ticks); } /* Return number of elapsed seconds */ unsigned long clock_seconds(void) { uint32_t tmp; TIMSK2 &= ~(1 << OCIE2A) | (1 << TOIE2); tmp = global_system_ticks / 32; TIMSK2 |= (1 << OCIE2A) | (1 << TOIE2); return (tmp); } void clock_init() { /* Enable external oscillator (32 kHz crystal) connected to TOSC{1,2} */ ASSR |= (1 << AS2); /* Reset timer */ TCNT2 = 0; /* Set TS/8 prescaler, results in a 4096Hz clock */ TCCR2B |= (1 << CS21); /* Compare at half counter value */ OCR2A = 128; /* * Enable overflow and compare interrupt. * Triggers each 1/32 secs */ TIMSK2 |= (1 << OCIE2A) | (1 << TOIE2); }
May
28
2009
MoreThanAll MagJack Eagle PCB footprintPosted by fli in General, tags: Eagle, footprint, MagJack, PCB
Here is an Eagle PCB footprint I created for the MagJack (MJF13T36L-KF06B3GY-0808) from MoreThanAll sold by Sparkfun. This one has been proven in production and it works, however you should double- (and triple-) check pin-outs and footprint of your device before sending a PCB for manufacturing using this part. Use at your own risk. DownloadThe binary for the VLC UnRAR plugin 0.9.8a-20090307 for Linux/i486 have been re-rolled because the packaged version appeared to have been compiled with the wrong settings causing it to fail on certain platforms. The new version should hopefully work okay.
The most competent console tool for this in FreeBSD is probably Mpd5. It’s quite easy to work with but you’ll need to get all the details right otherwise it just won’t work. The following mpd.conf configuration file worked for me and allowed me to successfully connect to a Windows VPN. One of the keys were to disable EAP, this particular VPN server just plain refused to work with it enabled
Save it to a file, say mpd.conf in /usr/local/etc/mpd.conf and simply run mpd5 mpd.conf and with some luck you’ll be connected the the VPN. The order of the statements are important. As they only apply to the current selected link (create link) or bundle (create bundle). Keep this in mind when editing. Windows logon nameIf you’re connecting to a Windows network you’ll probably need to use “DOMAIN\\username” as the authname (with the quotes and double backslash). Firewall and NAT issuesThe PPTP protocol is far from ideal. If you’re behind NAT chances are you won’t be able to do multiple PPTP connections to the same VPN server from within your LAN. You’ll also need to allow the GRE protocol through, with Free/OpenBSD pf (packet filter) the following line is enough (you still won’t be able to do simultaneous connections to the same server though) pass out on $ext_if proto gre from ($ext_if) to any keep state Replace $ext_if with your external network interface. New maintenance release (bug fix only) of the VLC UnRAR plugin. A small number of bugs have been fixed, no new features. Binaries for VLC 0.9.8a available for the following platforms
You can grab it from the VLC UnRAR plugin page. All binaries have been tested and should work fine (the wide range of different Linux installations makes this platform especially hard to support with binaries). A big thanks to Pontus Fyhr who provided a shell on his Intel mac which allowed me to build an Intel version. Source code is of course available as well if you want to attempt to build it yourself. I’ll gladly host third party builds for other platforms. |



Entries (RSS)