Ich will einen bestimmten Spannungsverlauf durch PWM mit einem ATtiny 13 realisieren. Da Arrays nach meiner Kenntnis bis zu 255 Werte enthalten können, wollte ich meine Werte in ein Array packen und sie dann nacheinander auslesen und als PWM ausgeben. Mit Bascom gingen aber nur ca 60 Werte rein, dann kam bei Bascom die Meldung "out of RAM...". Das verstehe ich nicht, denn wenn ich die Werte nacheinander als Zeilen in's Programm (siehe unten) schreibe, reicht der RAM-Speicher und das Programm ließ sich compilieren. Brauchen Arrays so viel mehr Platz? Das unten stehende Programm erscheint mir sehr primitiv, eine Abarbeitung der Werte aus einem Array oder String wäre eleganter. Hat jemand eine Idee?
Alles anzeigen
BASCOM-Quellcode
- _______________________________________________________
- $regfile = "attiny13.dat"
- $crystal = 9600000
- $hwstack = 10
- $swstack = 10
- $framesize = 10
- Config Portb = Output
- Config Timer0 = Pwm , Prescale = 1 , Compare A Pwm = Clear Down , Compare B Pwm = Clear Down
- Do
- Pwm0a = 2250
- Waitms 10
- Pwm0a = 200
- Waitms 10
- Pwm0a = 150
- Waitms 10
- Pwm0a = 90
- Waitms 10
- Pwm0a = 60
- Waitms 10
- Pwm0a = 55
- Waitms 10
- Pwm0a = 53
- Waitms 10
- Pwm0a = 51
- Waitms 10
- Pwm0a = 50
- Waitms 10
- Pwm0a = 49
- Waitms 10
- Pwm0a = 49
- Waitms 10
- Pwm0a = 50
- Waitms 10
- Pwm0a = 52
- Waitms 10
- Pwm0a = 53
- Waitms 10
- Pwm0a = 55
- Waitms 10
- Pwm0a = 57
- Waitms 10
- Pwm0a = 59
- Waitms 10
- Pwm0a = 60
- Waitms 10
- Pwm0a = 61
- Waitms 10
- Pwm0a = 60
- Waitms 10
- Pwm0a = 60
- Waitms 10
- Pwm0a = 59
- Waitms 10
- Pwm0a = 58
- Waitms 10
- Pwm0a = 57
- Waitms 10
- Pwm0a = 56
- Waitms 10
- Pwm0a = 55
- Waitms 10
- Pwm0a = 55
- Waitms 10
- Pwm0a = 54
- Waitms 10
- Pwm0a = 53
- Waitms 10
- Pwm0a = 52
- Waitms 10
- Pwm0a = 52
- Waitms 10
- Pwm0a = 51
- Waitms 10
- Pwm0a = 51
- Waitms 10
- Pwm0a = 51
- Waitms 10
- Pwm0a = 50
- Waitms 10
- Pwm0a = 50
- Waitms 10
- Pwm0a = 50
- Waitms 10
- Pwm0a = 50
- Waitms 10
- Pwm0a = 50
- Waitms 10
- Pwm0a = 50
- Waitms 10
- Pwm0a = 50
- Waitms 10
- Pwm0a = 50
- Waitms 10
- Pwm0a = 50
- Waitms 10
- Pwm0a = 50
- Waitms 10
- Pwm0a = 50
- Waitms 10
- Pwm0a = 51
- Waitms 10
- Pwm0a = 53
- Waitms 10
- Pwm0a = 55
- Waitms 10
- Pwm0a = 57
- Waitms 10
- Pwm0a = 59
- Waitms 10
- Pwm0a = 62
- Waitms 10
- Pwm0a = 64
- Waitms 10
- Pwm0a = 65
- Waitms 10
- Pwm0a = 66
- Waitms 20
- Pwm0a = 67
- Waitms 10
- Pwm0a = 67
- Waitms 10
- Pwm0a = 66
- Waitms 20
- Pwm0a = 65
- Waitms 10
- Pwm0b = 64
- Waitms 10
- Pwm0a = 63
- Waitms 10
- Pwm0a = 62
- Waitms 10
- Pwm0a = 61
- Waitms 10
- Pwm0a = 60
- Waitms 10
- Pwm0a = 57
- Waitms 10
- Pwm0a = 55
- Waitms 10
- Pwm0a = 53
- Waitms 10
- Pwm0a = 51
- Waitms 10
- Pwm0a = 49
- Waitms 10
- Pwm0a = 47
- Waitms 10
- Pwm0a = 46
- Waitms 10
- Pwm0a = 45
- Waitms 10
- Pwm0a = 44
- Waitms 10
- Pwm0a = 42
- Waitms 10
- Pwm0a = 42
- Waitms 10
- Pwm0a = 42
- Waitms 10
- Pwm0a = 42
- Waitms 10
- Pwm0a = 38
- Waitms 10
- Pwm0a = 31
- Waitms 10
- Pwm0a = 20
- Waitms 10
- Pwm0a = 120
- Waitms 10
- Pwm0a = 190
- Waitms 10
- Loop
- End