BASCOM AVR в вопросах и ответах
-
Radan
- Мучитель микросхем
- Сообщения: 465
- Зарегистрирован: Ср июн 21, 2006 08:24:32
- Откуда: Лисичанск
- Контактная информация:
Re: BASCOM AVR в вопросах и ответах
Сейчас ведутся интенсивные переговоры с Марком Альбертсом о снижении цены на лицензию BASCOM-AVR для жителей постсоветского пространства. Просьба проявить гражданскую сознательность и правдиво ответить на указанный вопрос.
http://bascomavr.3bb.ru/viewtopic.php?id=403
http://bascomavr.3bb.ru/viewtopic.php?id=403
Re: BASCOM AVR в вопросах и ответах
Голосование должно быть БЕЗ РЕГИСТРАЦИИ.
Будете проходить мимо- проходите!
-
Radan
- Мучитель микросхем
- Сообщения: 465
- Зарегистрирован: Ср июн 21, 2006 08:24:32
- Откуда: Лисичанск
- Контактная информация:
Re: BASCOM AVR в вопросах и ответах
radio-kot писал(а):Голосование должно быть БЕЗ РЕГИСТРАЦИИ.
Я обеими лапами "ЗА"! Особенно на Радиокоте!
-
aleksandr-zh
- Сверлит текстолит когтями
- Сообщения: 1278
- Зарегистрирован: Пн июн 18, 2007 21:51:20
Re: BASCOM AVR в вопросах и ответах
проголосовал
- SarCity
- Прорезались зубы
- Сообщения: 215
- Зарегистрирован: Вт июн 10, 2008 09:17:06
- Откуда: г. Саратов
- Контактная информация:
Re: BASCOM AVR в вопросах и ответах
А можно ли добавлять кода СИ в код баском? Знаю, что асм можно, а про СИ не знаю.
-
aleksandr-zh
- Сверлит текстолит когтями
- Сообщения: 1278
- Зарегистрирован: Пн июн 18, 2007 21:51:20
Re: BASCOM AVR в вопросах и ответах
а сами-то как думаете?
ассм - универсальная вещь для конкретного семейства МК, его "поддерживает" транслятор ассма
А Си - мега-куча вариантов
Bascom - один язык, Си - другие языки
Думаю, поняли
- kip96
- Держит паяльник хвостом
- Сообщения: 965
- Зарегистрирован: Ср авг 26, 2009 08:24:50
- Откуда: 1300км от Пупа
Re: BASCOM AVR в вопросах и ответах
Коты, подскажите , как в баскоме отправить по RS232 HEX код длиной 4-8 байт и получить ответ такой-же ?
Все делают ошибки, только мудрецы - новые, а дураки - старые.
-
aleksandr-zh
- Сверлит текстолит когтями
- Сообщения: 1278
- Зарегистрирован: Пн июн 18, 2007 21:51:20
Re: BASCOM AVR в вопросах и ответах
...
$crystal = 8000000
$baud = 9600
...
Print Hex(Volts)
читаем справку, смотрим многочисленные примеры
$crystal = 8000000
$baud = 9600
...
Print Hex(Volts)
читаем справку, смотрим многочисленные примеры
- kip96
- Держит паяльник хвостом
- Сообщения: 965
- Зарегистрирован: Ср авг 26, 2009 08:24:50
- Откуда: 1300км от Пупа
Re: BASCOM AVR в вопросах и ответах
Это я знаю
Как мне передать такое к примеру:
02 05 АВ FA
причём первый байт стартовый-постоянный, второй практически тоже, меняется третий и четвёртый.
Т.Е. получается надо выводить-
Но после каждого "принт" идёт команда перевода каретки на новую строку.(чё-эт такое и как оно выглядит?)
Я так понимаю 02 05 АВ FA не получится передать?
Как мне передать такое к примеру:
02 05 АВ FA
причём первый байт стартовый-постоянный, второй практически тоже, меняется третий и четвёртый.
Т.Е. получается надо выводить-
Код: Выделить всё
Print Hex(a)
Print Hex(b)
Print Hex(c)
Print Hex(d)Но после каждого "принт" идёт команда перевода каретки на новую строку.(чё-эт такое и как оно выглядит?)
Я так понимаю 02 05 АВ FA не получится передать?
Все делают ошибки, только мудрецы - новые, а дураки - старые.
-
aleksandr-zh
- Сверлит текстолит когтями
- Сообщения: 1278
- Зарегистрирован: Пн июн 18, 2007 21:51:20
Re: BASCOM AVR в вопросах и ответах
вы неверно задали вопрос, поэтому неверный ответ получили...
вам надо будет делать свою подпрограмму вывода данных в UART на основе PRINTBIN
преобразовать dec в hex
hex в символы
каждый символ выдавать через printbin
я так думаю (хотя могу и ошибаться - думал мало, думаю над другими проблемами)
вам надо будет делать свою подпрограмму вывода данных в UART на основе PRINTBIN
преобразовать dec в hex
hex в символы
каждый символ выдавать через printbin
я так думаю (хотя могу и ошибаться - думал мало, думаю над другими проблемами)
- kip96
- Держит паяльник хвостом
- Сообщения: 965
- Зарегистрирован: Ср авг 26, 2009 08:24:50
- Откуда: 1300км от Пупа
Re: BASCOM AVR в вопросах и ответах
направление понял!
строчка:
выдала то что нужно в симуляторе
Осталось научить контроллер принимать и обрабатывать ответ
строчка:
Код: Выделить всё
A = &H12
B = &H13
C = &H55
D = &H11
Printbin A ; B ; C ; Dвыдала то что нужно в симуляторе
Осталось научить контроллер принимать и обрабатывать ответ
Все делают ошибки, только мудрецы - новые, а дураки - старые.
-
aleksandr-zh
- Сверлит текстолит когтями
- Сообщения: 1278
- Зарегистрирован: Пн июн 18, 2007 21:51:20
Re: BASCOM AVR в вопросах и ответах
можно и так сделать, абы работало 
принимать по 1 символу(!), затем принятые символы склеить в одну строку
принимать по 1 символу(!), затем принятые символы склеить в одну строку
- ВНН
- Потрогал лапой паяльник
- Сообщения: 347
- Зарегистрирован: Сб дек 13, 2008 09:03:43
- Откуда: г.Советская Гавань
Re: BASCOM AVR в вопросах и ответах
kip96
Const B1=8
Dim Block1(B1) as byte
Дапее по циклу FOR B1=1 TO бла бла бла
или по сравнению IF B1<8 Then бла бла бла
С масивом работать более удобней при потоковых данных
Удачи
Const B1=8
Dim Block1(B1) as byte
Дапее по циклу FOR B1=1 TO бла бла бла
или по сравнению IF B1<8 Then бла бла бла
С масивом работать более удобней при потоковых данных
Удачи
Я тоже белый и пушистый и также как и Вы ловлю мышей.
С уважением ВНН.
С уважением ВНН.
- kip96
- Держит паяльник хвостом
- Сообщения: 965
- Зарегистрирован: Ср авг 26, 2009 08:24:50
- Откуда: 1300км от Пупа
Re: BASCOM AVR в вопросах и ответах
Спасибо, учту!
ВНН, хочу сделать для работы,портативный приборчик для считывания номера "клизмы". чтобы девчёнки наши сами могли, а на будущее чтобы на месте тестить её, так сказать в полевых условиях.
ВНН, хочу сделать для работы,портативный приборчик для считывания номера "клизмы". чтобы девчёнки наши сами могли, а на будущее чтобы на месте тестить её, так сказать в полевых условиях.
Все делают ошибки, только мудрецы - новые, а дураки - старые.
Re: BASCOM AVR в вопросах и ответах
Вышла версия 2.0.0.0
2.0.0.0 , yes this is the new version number
- RAMPZ : when Z is loaded, the RAMPZ is set when it was used before to point to data in flash memory.
This will generate more code but is needed because when RAMPZ is changed and data is exchanged between X and Z, it is important
that Z points to the proper data in RAM.
- readsig() added for xmega, use it to load calibration data
- beta : added stackcheck directive $hwcheck,$framecheck and $softcheck
- xmega buffered serial input supported
- xmega config adc did not support CH1_GAIN - CH3_GAIN parameters.
- split() supports variable for the delimiter too now. (previously it only supported a constant)
- declare function/sub REQUIRE (). So declare sub test is NOT ok, but declare sub test() is.
- Xmega AES encyption/decryption added. See xm128-aes.bas
- xmega TWI support added. By default TWIC will be used unless you use OPEN "TWIx"
config TWI will enable the TWI so it is important to add it : CONFIG TWI|TWIC|TWID|TWIE|TWIF=baud
open "TWIC" for binary as #1
i2cinit #1
i2cstart #1
i2cwbyte value ,#1
i2crbyte value,ack|nack,#1
i2cstop #1
without # the default TWIC will be used.
- various xmega uart bugs resolved (some could lead to a stack error)
- $bgf had a problem with big images. this was actually a problem of the assembler. this could give problems for large font files too.
- Xmega baud rate calculation improved, now the lowest possible error will be calculated for BSEL/BSCALE.
- config servo has a new parameter and alternative code for working with servos. when using INTERVAL=t , then the alternative code will be
used.
It is best to use a reload value of 100 and an interval of 100. This is optimized for normal RC servos.
- instead of ar(a+1) you can also use a variable : ar(A+J)
- bylabel added to sub/function which allows to pass the address of a label.
- uarts of type 3 (shared UBRI register) did not set UMSEL bit resulting in bad data bits. using CONFIG COM did/does work correct. This problem
was only visible when
using the old style where the com port is automatic configured when using $BAUD.
- soft spi now supports mode 0,1,2 and 3. if not specifying mode=, then the default mode 1 will be used.
when using the MODE, you can also specify setup and speed. setup and speed expect a numeric constant.
setup is the delay in uS before sampeling the MISO pin. speed is a delay in us. when you specify 1, it will result in a 2 uS or 500 KHz clock.
(estimated)
you can use either SS or NOSS, NOSS and SS are inverted. to disable SS use : SS=NONE, or NOSS=1
- toggle for arrays with constant bit number worked on element 1.
- DIDR reg added to tiny2313
- mcs bootloader can send EEP file too if it exists.
- accessing an array in a sub/function with a local var and offset (var(a+3)) did not added the offset to the element.
- m48Pdef.dat file added
- getrc5 , use 2000 for the 131 ms wait as it was in 1.11.9.8
- config print2 end print3 did not set rs485 level for the PRINT statement.
- the idle, powersave and powerdown are depriciated. use power [option].
the old statements will convert automatic to the new power statement.
- m1284p added to config clock.
- tiny13A dat file added. Notice that this A version has the same signature as the normal Tiny13.
- in options, enviroment, IDE you can select to check the version when you start the IDE
- tiny25,45 and 85 did not had a timer1 reference in the dat file (alias for tcnt1)
- crc32 uses a word for the number of bytes instead of a byte
- the simulator saves the state of the EEPROM. This means that when writing the EEPROM, you
Use the popup menu to clear the EEPROM (set all values to FF)
- uspasp and other atmel programmers did not erase the chip when using 'autoprogram'. Also auto refresh for lock and fuse bits was not enabled.
- stcheck used brge(signed compare) instead of brsh(unsigned compare)
- tiny48/tiny88 do not support HW MUL, dat files adjusted.
- mmc.lib saves R23 in case an extened port is used for the interface.
- charpos() accepts additional parameter with starting value. (>0)
- ####### IMPORTANT FEATURE ########
config base=0 | 1 added. By default arrays are 1 based in bascom. with config base=0, arrays start a 0.
dim ar(5) will occupy elements 0-4 ! In some old basic(QB) and VB it would take 0-5 thus 1 additional element.
- config lcdpin did not override options from the CFG file when bus mode was selected.
- waitus accepts a variable too. it will only work reliable when the oscillator speed is high enough.
- config i2cdelay did not update ___I2CDELAY constant used by soft i2c.
- mcs bootloader will ask if EEP file need to be programmed when this file exists.
- max() procedure (not the function) returned wrong index value for bytes which had the ms bit set(signed compare was used instead of unsigned).
2.0.0.0 , yes this is the new version number
- RAMPZ : when Z is loaded, the RAMPZ is set when it was used before to point to data in flash memory.
This will generate more code but is needed because when RAMPZ is changed and data is exchanged between X and Z, it is important
that Z points to the proper data in RAM.
- readsig() added for xmega, use it to load calibration data
- beta : added stackcheck directive $hwcheck,$framecheck and $softcheck
- xmega buffered serial input supported
- xmega config adc did not support CH1_GAIN - CH3_GAIN parameters.
- split() supports variable for the delimiter too now. (previously it only supported a constant)
- declare function/sub REQUIRE (). So declare sub test is NOT ok, but declare sub test() is.
- Xmega AES encyption/decryption added. See xm128-aes.bas
- xmega TWI support added. By default TWIC will be used unless you use OPEN "TWIx"
config TWI will enable the TWI so it is important to add it : CONFIG TWI|TWIC|TWID|TWIE|TWIF=baud
open "TWIC" for binary as #1
i2cinit #1
i2cstart #1
i2cwbyte value ,#1
i2crbyte value,ack|nack,#1
i2cstop #1
without # the default TWIC will be used.
- various xmega uart bugs resolved (some could lead to a stack error)
- $bgf had a problem with big images. this was actually a problem of the assembler. this could give problems for large font files too.
- Xmega baud rate calculation improved, now the lowest possible error will be calculated for BSEL/BSCALE.
- config servo has a new parameter and alternative code for working with servos. when using INTERVAL=t , then the alternative code will be
used.
It is best to use a reload value of 100 and an interval of 100. This is optimized for normal RC servos.
- instead of ar(a+1) you can also use a variable : ar(A+J)
- bylabel added to sub/function which allows to pass the address of a label.
- uarts of type 3 (shared UBRI register) did not set UMSEL bit resulting in bad data bits. using CONFIG COM did/does work correct. This problem
was only visible when
using the old style where the com port is automatic configured when using $BAUD.
- soft spi now supports mode 0,1,2 and 3. if not specifying mode=, then the default mode 1 will be used.
when using the MODE, you can also specify setup and speed. setup and speed expect a numeric constant.
setup is the delay in uS before sampeling the MISO pin. speed is a delay in us. when you specify 1, it will result in a 2 uS or 500 KHz clock.
(estimated)
you can use either SS or NOSS, NOSS and SS are inverted. to disable SS use : SS=NONE, or NOSS=1
- toggle for arrays with constant bit number worked on element 1.
- DIDR reg added to tiny2313
- mcs bootloader can send EEP file too if it exists.
- accessing an array in a sub/function with a local var and offset (var(a+3)) did not added the offset to the element.
- m48Pdef.dat file added
- getrc5 , use 2000 for the 131 ms wait as it was in 1.11.9.8
- config print2 end print3 did not set rs485 level for the PRINT statement.
- the idle, powersave and powerdown are depriciated. use power [option].
the old statements will convert automatic to the new power statement.
- m1284p added to config clock.
- tiny13A dat file added. Notice that this A version has the same signature as the normal Tiny13.
- in options, enviroment, IDE you can select to check the version when you start the IDE
- tiny25,45 and 85 did not had a timer1 reference in the dat file (alias for tcnt1)
- crc32 uses a word for the number of bytes instead of a byte
- the simulator saves the state of the EEPROM. This means that when writing the EEPROM, you
Use the popup menu to clear the EEPROM (set all values to FF)
- uspasp and other atmel programmers did not erase the chip when using 'autoprogram'. Also auto refresh for lock and fuse bits was not enabled.
- stcheck used brge(signed compare) instead of brsh(unsigned compare)
- tiny48/tiny88 do not support HW MUL, dat files adjusted.
- mmc.lib saves R23 in case an extened port is used for the interface.
- charpos() accepts additional parameter with starting value. (>0)
- ####### IMPORTANT FEATURE ########
config base=0 | 1 added. By default arrays are 1 based in bascom. with config base=0, arrays start a 0.
dim ar(5) will occupy elements 0-4 ! In some old basic(QB) and VB it would take 0-5 thus 1 additional element.
- config lcdpin did not override options from the CFG file when bus mode was selected.
- waitus accepts a variable too. it will only work reliable when the oscillator speed is high enough.
- config i2cdelay did not update ___I2CDELAY constant used by soft i2c.
- mcs bootloader will ask if EEP file need to be programmed when this file exists.
- max() procedure (not the function) returned wrong index value for bytes which had the ms bit set(signed compare was used instead of unsigned).
Re: BASCOM AVR в вопросах и ответах
Посмотрел:
- IDE без видимых изменений
- код для MEGA48 (с включенной оптимизацией) сгенерился немного короче:
- 3970 для 2.0.0.0 против
- 3974 для 1.11.9.2 и
- 3978 для 1.12.0.0
- IDE без видимых изменений
- код для MEGA48 (с включенной оптимизацией) сгенерился немного короче:
- 3970 для 2.0.0.0 против
- 3974 для 1.11.9.2 и
- 3978 для 1.12.0.0
- dubishe
- Встал на лапы
- Сообщения: 86
- Зарегистрирован: Чт авг 26, 2010 18:17:24
- Откуда: Харьков
- Контактная информация:
Re: BASCOM AVR в вопросах и ответах
А вот такой вопрос. Написал простейшую мигалку (бегущий огонь) на 8 меге.
Но почемуто на PD1 постоянно горит диод. Все остальные выводы порта работают нормально. Погасить не получаеться. Сильно не пинать-я только вчера за bascom сел.
Но почемуто на PD1 постоянно горит диод. Все остальные выводы порта работают нормально. Погасить не получаеться. Сильно не пинать-я только вчера за bascom сел.
Config Portd = Output
Portd = 0
A = 0
Pind.1 = 0
Pusk:
Waitms 50
Portd = 0
Pind.a = 1
Waitms 50
A = A + 1
If A = 8 Then Goto Konec
Goto Pusk
Konec:
A = 8
Krug:
waitms 50
A = A - 1
Portd = 0
Pind.a = 1
If A = 0 Then Goto Pusk
Goto Krug
-
aleksandr-zh
- Сверлит текстолит когтями
- Сообщения: 1278
- Зарегистрирован: Пн июн 18, 2007 21:51:20
Re: BASCOM AVR в вопросах и ответах
в программе ошибки
1. В АВР к одной и той же ноге в разных режимах надо обращаться по-разному:
при чтении -как к PIN
при записи - как к Port
у вас режим записи, а обращение как к при чтении
1. В АВР к одной и той же ноге в разных режимах надо обращаться по-разному:
при чтении -как к PIN
при записи - как к Port
у вас режим записи, а обращение как к при чтении
- dubishe
- Встал на лапы
- Сообщения: 86
- Зарегистрирован: Чт авг 26, 2010 18:17:24
- Откуда: Харьков
- Контактная информация:
Re: BASCOM AVR в вопросах и ответах
Можно на ты. ))
Тоесть на вывод все будет portb чегототам?
Тоесть на вывод все будет portb чегототам?
Последний раз редактировалось dubishe Пн окт 11, 2010 21:32:20, всего редактировалось 2 раза.
-
aleksandr-zh
- Сверлит текстолит когтями
- Сообщения: 1278
- Зарегистрирован: Пн июн 18, 2007 21:51:20
Re: BASCOM AVR в вопросах и ответах
да, проверь это: (сам не проверял, просто пример)
Config Portd = Output
aaa:
Portd = 1
waitms 300
Portd = 0
waitms 300
Goto aaa
с периодичностью в 300 мс будет переключаться вывод нулевого бита порта D
Если не будет - смотри свою схему: может что закорочено или к плюсу тянет...
Config Portd = Output
aaa:
Portd = 1
waitms 300
Portd = 0
waitms 300
Goto aaa
с периодичностью в 300 мс будет переключаться вывод нулевого бита порта D
Если не будет - смотри свою схему: может что закорочено или к плюсу тянет...