You can subscribe to this list here.
2006 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(2) |
Dec
(5) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2007 |
Jan
|
Feb
(6) |
Mar
(41) |
Apr
(23) |
May
(11) |
Jun
(2) |
Jul
|
Aug
|
Sep
(9) |
Oct
(2) |
Nov
(1) |
Dec
(1) |
2008 |
Jan
(6) |
Feb
(1) |
Mar
(23) |
Apr
(18) |
May
(21) |
Jun
(13) |
Jul
(34) |
Aug
(5) |
Sep
(1) |
Oct
(4) |
Nov
|
Dec
(4) |
2009 |
Jan
|
Feb
(5) |
Mar
(5) |
Apr
(10) |
May
(1) |
Jun
(11) |
Jul
(1) |
Aug
|
Sep
|
Oct
(2) |
Nov
(3) |
Dec
(13) |
2010 |
Jan
(10) |
Feb
(4) |
Mar
(28) |
Apr
(3) |
May
(38) |
Jun
(22) |
Jul
(92) |
Aug
(154) |
Sep
(218) |
Oct
(45) |
Nov
(20) |
Dec
(1) |
2011 |
Jan
(33) |
Feb
(15) |
Mar
(32) |
Apr
(33) |
May
(48) |
Jun
(35) |
Jul
(7) |
Aug
|
Sep
(11) |
Oct
(5) |
Nov
|
Dec
(7) |
2012 |
Jan
(56) |
Feb
(11) |
Mar
(6) |
Apr
|
May
(128) |
Jun
(59) |
Jul
(21) |
Aug
(16) |
Sep
(24) |
Oct
(39) |
Nov
(12) |
Dec
(12) |
2013 |
Jan
(14) |
Feb
(61) |
Mar
(97) |
Apr
(46) |
May
(13) |
Jun
(23) |
Jul
(12) |
Aug
(25) |
Sep
(9) |
Oct
(81) |
Nov
(73) |
Dec
(45) |
2014 |
Jan
(36) |
Feb
(57) |
Mar
(20) |
Apr
(41) |
May
(43) |
Jun
(11) |
Jul
(14) |
Aug
(32) |
Sep
(9) |
Oct
(27) |
Nov
(21) |
Dec
(6) |
2015 |
Jan
(14) |
Feb
(23) |
Mar
(1) |
Apr
(19) |
May
(40) |
Jun
(11) |
Jul
(1) |
Aug
(2) |
Sep
(14) |
Oct
(10) |
Nov
(9) |
Dec
(13) |
2016 |
Jan
(4) |
Feb
(3) |
Mar
(7) |
Apr
|
May
(4) |
Jun
(13) |
Jul
(8) |
Aug
(3) |
Sep
(4) |
Oct
(1) |
Nov
|
Dec
|
2017 |
Jan
(6) |
Feb
(1) |
Mar
(1) |
Apr
(7) |
May
(10) |
Jun
(5) |
Jul
(7) |
Aug
(9) |
Sep
|
Oct
(1) |
Nov
(5) |
Dec
|
2018 |
Jan
|
Feb
|
Mar
(5) |
Apr
|
May
|
Jun
(3) |
Jul
(6) |
Aug
|
Sep
(2) |
Oct
(54) |
Nov
(47) |
Dec
(53) |
2019 |
Jan
(23) |
Feb
(24) |
Mar
(19) |
Apr
(15) |
May
(5) |
Jun
(34) |
Jul
(9) |
Aug
(9) |
Sep
(3) |
Oct
(2) |
Nov
|
Dec
|
2020 |
Jan
|
Feb
|
Mar
(7) |
Apr
(7) |
May
(5) |
Jun
(15) |
Jul
(22) |
Aug
(28) |
Sep
(13) |
Oct
(9) |
Nov
(17) |
Dec
(13) |
2021 |
Jan
(5) |
Feb
(1) |
Mar
(1) |
Apr
(9) |
May
(21) |
Jun
(9) |
Jul
|
Aug
(6) |
Sep
(16) |
Oct
|
Nov
(1) |
Dec
(6) |
2022 |
Jan
|
Feb
|
Mar
|
Apr
(7) |
May
(6) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2023 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(11) |
Sep
(21) |
Oct
(5) |
Nov
(1) |
Dec
(1) |
2024 |
Jan
(1) |
Feb
(4) |
Mar
|
Apr
(7) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(1) |
Nov
|
Dec
|
From: Matthias T. <mt...@we...> - 2018-11-05 19:04:34
|
Hi, > When I do the command $1d c@ . I get a value of 0001000. How is that > possible? Or do I something wrong? Historically Atmel defined 32 special addresses that together with certain opcodes that are used for some IO or CPU relevant things (e.g. the machine status register which is one of them). They are mapped into the "normal" memory addresses with an offset of 32 (0x20). "real" RAM memory starts at address $40 (32 registers and 32 IO registers). The lowest 32 "memory" addresses are used for the CPU registers itself. $1d is part of the Y register pair amforth uses as data stack pointer. HTH Matthias |
From: Jan K. <jan...@ic...> - 2018-11-05 18:27:34
|
Tristan, I have found the datasheet. Cheers, Jan Verstuurd vanaf mijn iPad > Op 5 nov. 2018 om 11:26 heeft Jan Kromhout <kro...@ho...> het volgende geschreven: > > Tristan, > > Thanks again for your hulp. > Please can you provide me the link to download the datasheet your mention. When I look to the > datasheets they only have about 25 pages!!. > > Cheers, > > Jan > > >> Op 5 nov. 2018, om 09:47 heeft Tristan Williams <ho...@tj...> het volgende geschreven: >> >> Jan, >> >>> The address is $1d. When I look to the documentation te bits 0 and 1 >>> are R/W and the other bits are only Read (With a initial value of 0) >>> When I do the command $1d c@ . I get a value of 0001000. How is that >>> possible? Or do I something wrong? >> >> The answer to this lies in the memory map of the AVR. If you look at >> page 72 in the datasheet you will see the address for EIMSK given as >> >> 0x1D (0x3D) >> >> Yes, two addresses. >> >> To see the contents of EIMSK in AmForth using c@ you need >> >> $3d c@ >> >> For the why see page 19 of the datasheet combined with a >> Google of "avr memory map offset $20" >> >> The file amforth-root/avr8/devices/atmega328p/atmega328p.frt contains >> >> &61 constant EIMSK \ External Interrupt Mask Register >> >> (where &61 is $3d) along with the other constants and is a very useful >> file. >> >> Tristan >> >> >> >> >> >> >> _______________________________________________ >> Amforth-devel mailing list for http://amforth.sf.net/ >> Amf...@li... >> https://lists.sourceforge.net/lists/listinfo/amforth-devel > > > > _______________________________________________ > Amforth-devel mailing list for http://amforth.sf.net/ > Amf...@li... > https://lists.sourceforge.net/lists/listinfo/amforth-devel |
From: Jan K. <kro...@ho...> - 2018-11-05 10:27:36
|
Tristan, Thanks again for your hulp. Please can you provide me the link to download the datasheet your mention. When I look to the datasheets they only have about 25 pages!!. Cheers, Jan > Op 5 nov. 2018, om 09:47 heeft Tristan Williams <ho...@tj...> het volgende geschreven: > > Jan, > >> The address is $1d. When I look to the documentation te bits 0 and 1 >> are R/W and the other bits are only Read (With a initial value of 0) >> When I do the command $1d c@ . I get a value of 0001000. How is that >> possible? Or do I something wrong? > > The answer to this lies in the memory map of the AVR. If you look at > page 72 in the datasheet you will see the address for EIMSK given as > > 0x1D (0x3D) > > Yes, two addresses. > > To see the contents of EIMSK in AmForth using c@ you need > > $3d c@ > > For the why see page 19 of the datasheet combined with a > Google of "avr memory map offset $20" > > The file amforth-root/avr8/devices/atmega328p/atmega328p.frt contains > > &61 constant EIMSK \ External Interrupt Mask Register > > (where &61 is $3d) along with the other constants and is a very useful > file. > > Tristan > > > > > > > _______________________________________________ > Amforth-devel mailing list for http://amforth.sf.net/ > Amf...@li... > https://lists.sourceforge.net/lists/listinfo/amforth-devel |
From: Tristan W. <ho...@tj...> - 2018-11-05 08:48:29
|
Jan, > The address is $1d. When I look to the documentation te bits 0 and 1 > are R/W and the other bits are only Read (With a initial value of 0) > When I do the command $1d c@ . I get a value of 0001000. How is that > possible? Or do I something wrong? The answer to this lies in the memory map of the AVR. If you look at page 72 in the datasheet you will see the address for EIMSK given as 0x1D (0x3D) Yes, two addresses. To see the contents of EIMSK in AmForth using c@ you need $3d c@ For the why see page 19 of the datasheet combined with a Google of "avr memory map offset $20" The file amforth-root/avr8/devices/atmega328p/atmega328p.frt contains &61 constant EIMSK \ External Interrupt Mask Register (where &61 is $3d) along with the other constants and is a very useful file. Tristan |
From: Jan K. <kro...@ho...> - 2018-11-04 21:48:43
|
Hi, I have a strange behavior and can’t explain. The ATmega328P supports two external interrupts which are individually enabled by setting bits INT1 and INT0 in the External Interrupt Mask Register (EIMSK) The address is $1d. When I look to the documentation te bits 0 and 1 are R/W and the other bits are only Read (With a initial value of 0) When I do the command $1d c@ . I get a value of 0001000. How is that possible? Or do I something wrong? This code I are try to do in AmForth: \ PD2_interrupt \ Rotary switch is connected to pin 2 and 4 marker --pd2_interrupt-- PORTD 2 portpin: ROTARYPA PORTD 4 portpin: ROTARYPB ROTARYPA pin_input ROTARYPB pin_input $69 constant EICRA \ External Interrupt Control Register A $1d constant EIMSK \ External Interrupt Mask Register 0 constant ISC00 0 constant INT0 \ Interrupt on port PD2 1 constant INT1 \ Interrupt on port PD3 0 variable rotaryCount 0 variable lastRotaryCount : << lshift ; : rotaryTurn \ Interupt service routine for change to Rotary encoder pin A \ ROTARYPB pin_high? if -1 rotaryCount +! else 1 rotaryCount +! then ; : pd2_interrupt.init ( -- ) -int EICRA c@ 1 ISC00 << or EICRA c! \ set INT0 to trigger on ANY logic change EIMSK c@ 1 INT0 << or EIMSK c! \ Turns on INT0, PD2 +int \ turn on interrupts ; : pd2.start ['] rotaryTurn INT0Addr int! pd2_interrupt.init ; When I start I get this error: amforth 6.7 ATmega328P Forthduino > ok > pd2.start ?? -4 -21248 > ok > ok > ok > ok > ok > ok > ok > ok > ok > ?? -13 -21425 > ?? -13 -22213 > ok > ok > ok > ?? -13 -21241 > ?? -13 -21052 > ok > ?? -13 -21103 and more and more Cheers, Jan And this is the code in AVR Assembler ATmega168/328 Code: #include <avr/io.h> #include <avr/interrupt.h> int main(void) { DDRD &= ~(1 << DDD2); // Clear the PD2 pin // PD2 (PCINT0 pin) is now an input PORTD |= (1 << PORTD2); // turn On the Pull-up // PD2 is now an input with pull-up enabled EICRA |= (1 << ISC00); // set INT0 to trigger on ANY logic change EIMSK |= (1 << INT0); // Turns on INT0 sei(); // turn on interrupts while(1) { /*main program loop here */ } } ISR (INT0_vect) { /* interrupt code here */ } |
From: Matthias T. <mt...@we...> - 2018-11-04 14:16:21
|
> My leaving question is the word “f_cpu” in the code of Timer1.frt. > When I execute it I get two values on the stack. It's the current clock the controller is running at. It's a double cell number, since the 16bit controllers run too fast to keep this number in a single cell. Matthias |
From: Martin B. <mar...@t-...> - 2018-11-03 21:23:39
|
Hi Jan,, have a look at https://neu.forth-ev.de/wiki/res/lib/exe/fetch.php/vd-archiv:4d2018-02.pdf There is a topic: Drehgeber i.e. rotary encoder. Regards Martin Am Samstag, 3. November 2018, 20:39:18 CET schrieb Jan Kromhout via Amforth-devel: > Hello, > > Has someone tried to get a rotary-encoder/switch running under amforth with > interupt0 ( conected on pin 2and 3) . Or add a swich, and let it reacted > with this interrupt. > > Have tried with no succes. > > Thanks for any help. > > Cheers, > > Jan > > > > > _______________________________________________ > Amforth-devel mailing list for http://amforth.sf.net/ > Amf...@li... > https://lists.sourceforge.net/lists/listinfo/amforth-devel -- Getippt im 9-Fingersystem von mir selbst. |
From: Jan K. <jan...@ic...> - 2018-11-03 19:39:28
|
Hello, Has someone tried to get a rotary-encoder/switch running under amforth with interupt0 ( conected on pin 2and 3) . Or add a swich, and let it reacted with this interrupt. Have tried with no succes. Thanks for any help. Cheers, Jan |
From: Jan K. <kro...@ho...> - 2018-11-03 11:38:52
|
Hi, Thanks all for the suggestions. After reload the timer after every interrupt it is working great. My leaving question is the word “f_cpu” in the code of Timer1.frt. When I execute it I get two values on the stack. What is the meaning of this two values? Cheers, Jan Op 3 nov. 2018, om 12:31 heeft Richard Burden <ric...@gm...<mailto:ric...@gm...>> het volgende geschreven: Hi Jan I suggest that the ISR has to toggle the pin and re-load the timer1 counter. From memory timer1 counts upwards and once it overflows it just keeps counting up from zero unless you re-load it. Regards Richard On 11/3/18, Jan Kromhout <kro...@ho...<mailto:kro...@ho...>> wrote: Hi, I have taken the TIMER_1 example, and make some small change. Instead of the timer1.tick I toggle pin-7 of the Arduino. With the values as in the listing I measure a frequency of 15,2 Hz with my scoop. When I change some of the preload value by hand no change is seeing. Frequency is staying at 15,2 Hz. When I print the value of TCNT1 after setting, and compare this one after timer1.start there is a difference First value = 63536 and the Second value = 31033. I think some where in amForth TCNT1 is overwritten! Please can you take a look. I included my program. Cheers, Jan \ TIMER1_interrupt marker --timer1_interrupt-- PORTD 7 portpin: PD7 PD7 pin_output &26 constant TIMER1_OVFAddr : togglePD7 PD7 pin_high? if PD7 low else PD7 high then ; : timer1.isr \ toggle output PD7 togglePD7 ; \ preload for overflow interrupt every 1 ms \ preload = 65536 - (f_cpu / (prescaler * 1000)) : timer1.preload f_cpu #1000 um/mod nip 8 / negate \ <===== if i change the value #1000 notting is change ; : timer1.init ( -- ) timer1.preload TCNT1 ! TCNT1 @ u. cr \ <=============== print value of TCNT1 =========== ['] timer1.isr TIMER1_OVFAddr int! ; : timer1.start -int timer1.init %00000010 TCCR1B c! \ prescaler 8 %00000001 TIMSK1 c! \ enable overflow interrupt +int ; : timer1.stop %00000000 TCCR1B c! \ stop timer %00000000 TIMSK1 c! \ stop interrupt ; _______________________________________________ Amforth-devel mailing list for http://amforth.sf.net/ Amf...@li...<mailto:Amf...@li...> https://lists.sourceforge.net/lists/listinfo/amforth-devel _______________________________________________ Amforth-devel mailing list for http://amforth.sf.net/ Amf...@li...<mailto:Amf...@li...> https://lists.sourceforge.net/lists/listinfo/amforth-devel |
From: Richard B. <ric...@gm...> - 2018-11-03 11:31:33
|
Hi Jan I suggest that the ISR has to toggle the pin and re-load the timer1 counter. >From memory timer1 counts upwards and once it overflows it just keeps counting up from zero unless you re-load it. Regards Richard On 11/3/18, Jan Kromhout <kro...@ho...> wrote: > Hi, > > I have taken the TIMER_1 example, and make some small change. > Instead of the timer1.tick I toggle pin-7 of the Arduino. > With the values as in the listing I measure a frequency of 15,2 Hz with my > scoop. > > When I change some of the preload value by hand no change is seeing. > Frequency is staying at 15,2 Hz. > > When I print the value of TCNT1 after setting, and compare this one after > timer1.start there is a difference > > First value = 63536 and the Second value = 31033. > > I think some where in amForth TCNT1 is overwritten! > > Please can you take a look. > > I included my program. > > Cheers, > > Jan > > \ TIMER1_interrupt > > marker --timer1_interrupt-- > > PORTD 7 portpin: PD7 > PD7 pin_output > > &26 constant TIMER1_OVFAddr > > : togglePD7 > PD7 pin_high? if PD7 low else PD7 high then > ; > > : timer1.isr > \ toggle output PD7 > togglePD7 > ; > > \ preload for overflow interrupt every 1 ms > \ preload = 65536 - (f_cpu / (prescaler * 1000)) > > : timer1.preload > f_cpu #1000 um/mod nip 8 / negate \ <===== if i change the value #1000 > notting is change > ; > > : timer1.init ( -- ) > timer1.preload TCNT1 ! > TCNT1 @ u. cr \ <=============== print value of TCNT1 =========== > ['] timer1.isr TIMER1_OVFAddr int! > ; > > : timer1.start > -int > timer1.init > %00000010 TCCR1B c! \ prescaler 8 > %00000001 TIMSK1 c! \ enable overflow interrupt > +int > ; > > : timer1.stop > %00000000 TCCR1B c! \ stop timer > %00000000 TIMSK1 c! \ stop interrupt > ; > > > > _______________________________________________ > Amforth-devel mailing list for http://amforth.sf.net/ > Amf...@li... > https://lists.sourceforge.net/lists/listinfo/amforth-devel > |
From: Jan K. <jan...@ic...> - 2018-11-03 10:18:57
|
I agree with that. I came to the same conclusion. Checked yesterday also the code and found no action on this address. Tristian gave me a hint, and I will try it. Cheers, Jan |
From: Matthias T. <mt...@we...> - 2018-11-03 08:39:32
|
> I think some where in amForth TCNT1 is overwritten! I can assure you, that there is no code in plain amforth that overwrites your settings. It's either your code or the hardware itself. Matthias |
From: Tristan W. <ho...@tj...> - 2018-11-02 22:46:12
|
Jan, If you want to see different frequencies using your code I think you will need to reset TCNT1 to the value you want in your overflow isr. : timer1.isr \ toggle output PD7 togglePD7 \ reset TCNT1 your-value TCNT1 ! ; However, using CTC mode would be more accurate and efficient. Also if you are not too fussed on your multiplexing frequency then a different choice of timer and prescaler might make it easier. Your C code mentioned 200Hz I think. Have a look at timer0 (8 bit) with a /256 prescaler and an overflow isr. Best wishes, Tristan On 02Nov18 21:33, Jan Kromhout wrote: > Thanks Tristian, > > Yes, I’m looking for something i can use for multplexing 7-segment displays. > But still strange I can’t use this timer freely. > How could we figger out where this oceurs? > > But still thanks again for your helpfull remarks. > > Cheers, > > Jan > > > Verstuurd vanaf mijn iPad > _______________________________________________ > Amforth-devel mailing list for http://amforth.sf.net/ > Amf...@li... > https://lists.sourceforge.net/lists/listinfo/amforth-devel |
From: Jan K. <kro...@ho...> - 2018-11-02 21:33:28
|
Thanks Tristian, Yes, I’m looking for something i can use for multplexing 7-segment displays. But still strange I can’t use this timer freely. How could we figger out where this oceurs? But still thanks again for your helpfull remarks. Cheers, Jan Verstuurd vanaf mijn iPad |
From: Tristan W. <ho...@tj...> - 2018-11-02 21:26:44
|
Jan, > I think some where in amForth TCNT1 is overwritten! Indeed. Every time timer1 overflows. > When I change some of the preload value by hand no change is seeing. > Frequency is staying at 15,2 Hz. Yes. You are seeing a frequency of 16000000 divided by 8 (for the prescaler) divided by 65536 (for each rollover of the timer1) divided by 2 (for the LED toggle) which gives a theoretical 15.3Hz , close to your observed value. Are you looking to generate something for multiplexing a display? There might be an easier way, if that is the case. Best wishes, Tristan On 02Nov18 20:09, Jan Kromhout wrote: > Hi, > > I have taken the TIMER_1 example, and make some small change. > Instead of the timer1.tick I toggle pin-7 of the Arduino. > With the values as in the listing I measure a frequency of 15,2 Hz with my scoop. > > When I change some of the preload value by hand no change is seeing. > Frequency is staying at 15,2 Hz. > > When I print the value of TCNT1 after setting, and compare this one after > timer1.start there is a difference > > First value = 63536 and the Second value = 31033. > > I think some where in amForth TCNT1 is overwritten! > > Please can you take a look. > > I included my program. > > Cheers, > > Jan > > \ TIMER1_interrupt > > marker --timer1_interrupt-- > > PORTD 7 portpin: PD7 > PD7 pin_output > > &26 constant TIMER1_OVFAddr > > : togglePD7 > PD7 pin_high? if PD7 low else PD7 high then > ; > > : timer1.isr > \ toggle output PD7 > togglePD7 > ; > > \ preload for overflow interrupt every 1 ms > \ preload = 65536 - (f_cpu / (prescaler * 1000)) > > : timer1.preload > f_cpu #1000 um/mod nip 8 / negate \ <===== if i change the value #1000 notting is change > ; > > : timer1.init ( -- ) > timer1.preload TCNT1 ! > TCNT1 @ u. cr \ <=============== print value of TCNT1 =========== > ['] timer1.isr TIMER1_OVFAddr int! > ; > > : timer1.start > -int > timer1.init > %00000010 TCCR1B c! \ prescaler 8 > %00000001 TIMSK1 c! \ enable overflow interrupt > +int > ; > > : timer1.stop > %00000000 TCCR1B c! \ stop timer > %00000000 TIMSK1 c! \ stop interrupt > ; > > > > _______________________________________________ > Amforth-devel mailing list for http://amforth.sf.net/ > Amf...@li... > https://lists.sourceforge.net/lists/listinfo/amforth-devel > |
From: Jan K. <kro...@ho...> - 2018-11-02 20:09:39
|
Hi, I have taken the TIMER_1 example, and make some small change. Instead of the timer1.tick I toggle pin-7 of the Arduino. With the values as in the listing I measure a frequency of 15,2 Hz with my scoop. When I change some of the preload value by hand no change is seeing. Frequency is staying at 15,2 Hz. When I print the value of TCNT1 after setting, and compare this one after timer1.start there is a difference First value = 63536 and the Second value = 31033. I think some where in amForth TCNT1 is overwritten! Please can you take a look. I included my program. Cheers, Jan \ TIMER1_interrupt marker --timer1_interrupt-- PORTD 7 portpin: PD7 PD7 pin_output &26 constant TIMER1_OVFAddr : togglePD7 PD7 pin_high? if PD7 low else PD7 high then ; : timer1.isr \ toggle output PD7 togglePD7 ; \ preload for overflow interrupt every 1 ms \ preload = 65536 - (f_cpu / (prescaler * 1000)) : timer1.preload f_cpu #1000 um/mod nip 8 / negate \ <===== if i change the value #1000 notting is change ; : timer1.init ( -- ) timer1.preload TCNT1 ! TCNT1 @ u. cr \ <=============== print value of TCNT1 =========== ['] timer1.isr TIMER1_OVFAddr int! ; : timer1.start -int timer1.init %00000010 TCCR1B c! \ prescaler 8 %00000001 TIMSK1 c! \ enable overflow interrupt +int ; : timer1.stop %00000000 TCCR1B c! \ stop timer %00000000 TIMSK1 c! \ stop interrupt ; |
From: Matthias T. <mt...@we...> - 2018-11-02 17:22:41
|
> Is it correct that I can use this timer with his interrupts freely > without any harm/restrictions for Amforth? Yes, that's correct. Matthias |
From: Jan K. <jan...@ic...> - 2018-11-02 13:55:24
|
Hi, I have take a look into the excellent work of Erich Walde “Clock Works”. When I walk trough the code I see that Timer1 is used freely. Is it correct that I can use this timer with his interrupts freely without any harm/restrictions for Amforth? Cheers, Jan |
From: Jan K. <jan...@ic...> - 2018-11-01 13:45:35
|
Hello, On my regular Arduino I have running a processes under the Timer-Interrupt. At a frequentie of 200 Hz my routine is updating ISR(TIMER1_COMPA_vect). See my code below. How can I activate this kind of process in amForth? I appreciate all help. Cheers, Jan void setup() { noInterrupts(); TCCR1A = 0; TCCR1B = 0; TCNT1 = 0; /* Set timer values */ long f=200; /*200 Hz*/ long value = 16000000/256/f; OCR1A = (int)value ; TCCR1B = 0b00001100; TIMSK1 = 0b00000010; interrupts(); } ISR(TIMER1_COMPA_vect) { /*per interrupt wordt een van de vier 7-segment display's aangestuurd. Oog kan deze snelle verandering niet volgen. Komt de refresh onder de 150 hz gaan ze flikkeren */ WriteValueToSegment(idx, SEGMENT_MAP_DIGIT[Seven_segment_display[idx]]); idx += 1; if (idx > 3) idx = 0; } |
From: Jan K. <jan...@ic...> - 2018-10-31 12:00:35
|
Hi, Thanks all, information was very helpful. Cheers, Jan |
From: Tristan W. <ho...@tj...> - 2018-10-31 10:58:15
|
Jan, >From Erich Wälde's excellent commented project "Clock Works" I would recommend http://amforth.sourceforge.net/Projects/ClockWorks/07_shift_register.html Regards, Tristan On 31Oct18 10:11, Jan Kromhout wrote: > Hi, > > Is there a equivalence of the Arduino "shiftOut(dataPin, clockPin, bitOrder, value)" in Amforth? > > Cheers, > > Jan > > _______________________________________________ > Amforth-devel mailing list for http://amforth.sf.net/ > Amf...@li... > https://lists.sourceforge.net/lists/listinfo/amforth-devel > |
From: Martin B. <mar...@t-...> - 2018-10-31 10:56:46
|
Hello Jan, 'shift' and 'data' 'clock' lead me to the assumption that you want to deal wit SPI. If so just include ../avr8/words/sprw.asm while compiling. Take in account that here clockPin and dataPin are hardcoded. Maybe that ../avr8/lib/hardware/spi.frt meets your wishes better.(no compiling just loading) Regards Martin Am Mittwoch, 31. Oktober 2018, 10:11:28 CET schrieb Jan Kromhout: > Hi, > > Is there a equivalence of the Arduino "shiftOut(dataPin, clockPin, bitOrder, > value)" in Amforth? > > Cheers, > > Jan > > _______________________________________________ > Amforth-devel mailing list for http://amforth.sf.net/ > Amf...@li... > https://lists.sourceforge.net/lists/listinfo/amforth-devel -- Getippt im 9-Fingersystem von mir selbst. |
From: Jan K. <kro...@ho...> - 2018-10-31 10:11:41
|
Hi, Is there a equivalence of the Arduino "shiftOut(dataPin, clockPin, bitOrder, value)" in Amforth? Cheers, Jan |
From: Erich W. <ew....@na...> - 2018-10-29 21:07:48
|
Hello Jan, Jan Kromhout writes: > Hi, > > I have this simple Arduino program thats put a PWM signal to port 9 of the Arduino. > Checked with my RIGOL and the PWM is changed when I change the value of ppm. > > #define PWM_A 9 /* Pin-9 on Arduino Board */ > > void setup() { > Serial.begin(115200); > > int pwm = 200; /* duty 50% */ > pinMode(PWM_A, OUTPUT); > /* PWM speed is at 20 kHz */ > /*Set the timers */ > TCCR1A = 0b10100000; > TCCR1B = 0b00010001; > ICR1 = 400; > > /* value of 400 = 100 % ppm */ > > OCR1A = pwm; > } > > void loop() { > } > > > Convert it to amForth. > > \ Address of Timer/Counter Arduino UNO > \ Adresses are taken from device.py > \ Partname ATmega328P > > $80 constant TCCR1A \ Timer/Counter1 Control Register A > $81 constant TCCR1B \ Timer/Counter1 Control Register B > $86 constant ICR1 \ Timer/Counter1 Input Capture Register > $88 constant OCR1A \ Timer/Counter1 Output Compare Register A > $8a constant OCR1B \ Timer/Counter1 Output Compare Register B > > PORTB 1 portpin: PWM_A \ alias for digital pin 9 (PB1) > > : PWM_init > PWM_A pin_output \ Set pin 9 (PB1) to output > %10100000 TCCR1A c! \ Store constant > %00010001 TCCR1B c! \ Store constant > &400 OCR1A c! \ Store constant > ; 400 is larger than 255, so "c!" will not do, what you think. I have this snippet in my code (check amforth commented projects clockworks) for your inspiration. \ enable ticks \ crystal: 11059200 /sec \ prescaler: 256 \ 43200 /sec \ TOP+1: 1350 \ 32 /sec : +ticks 0 ct.ticks ! 0 ct.ticks.follow ! 0 last.tick[4] ! 0 last.tick[5] ! \ --- timer1 ! --- [ %00000000 \ WGM1[10] CTC mode %01000000 or \ COM1A[10] toggle OC1A on compare match ] literal TCCR1A c! #1350 1- OCR1A ! \ TOP or compare match value rather DDRD c@ $80 or DDRD c! \ pin OC2A output [ %00000100 \ CS1[210] clock_ts2/256 %00001000 or \ WGM1[32] CTC mode ] literal TCCR1B c! \ register isr ['] tick_isr TIMER1_COMPAAddr int! TIMSK1 c@ $02 or TIMSK1 c! \ enable OCIE1A interupt ; Cheers, Erich > > : PWM_set ( value -- ) \ PWM is between 0..400 > OCR1A c! \ Store into OCR1A > ; > > >> PWM_init >> 200 PWM_set > > > > It will not work. What do I wrong. > Thanks for any help > > Cheers, > > Jan > > _______________________________________________ > Amforth-devel mailing list for http://amforth.sf.net/ > Amf...@li... > https://lists.sourceforge.net/lists/listinfo/amforth-devel -- May the Forth be with you ... |
From: Matthias T. <mt...@we...> - 2018-10-29 19:56:48
|
> : PWM_init > PWM_A pin_output \ Set pin 9 (PB1) to output > %10100000 TCCR1A c! \ Store constant > %00010001 TCCR1B c! \ Store constant This stores a byte, &400 is beyond 8bits. Try ! instead > &400 OCR1A c! \ Store constant Matthias |