Forum > Embedded - AVR

Arduino zero level.

(1/1)

Seenkao:
Всем привет! Зная, что FPC компилирует код под AVR хотел узнать будет ли данный код работать на устройстве (это стандартный скетч, который используется средствами C/C++).
google translate: Hello everyone! Knowing that FPC compiles code for AVR, I wanted to know if this code will work on the device (this is a standard sketch that is used by C / C ++ tools).

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---program main; procedure setup;beginend; procedure loop;beginend; begin  setup;  while true do    loop;end. 

ccrause:
Yes. Since it is valid Pascal it will work.

Seenkao:
ccrause, благодарю! Но меня интересует не только как код Паскаля, а как приложение попавшее в память микроконтроллера, что это будет идентично коду:
google translate: thank you! But I'm not only interested in Pascal's code, but as an application that got into the microcontroller's memory, that it will be identical to the code:

--- Code: ASM  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---.text.org 0x0000jmp main main:        rcall setup        rcall loop        ret setup:        ret loop:        ret .endи микроконтроллер обработает его без ошибок.  :) У меня просто нет ни чего, для проверки кода... :(
google translate: and the microcontroller will process it without error. :) I just don't have anything to test the code ... :(

Seenkao:
Вопрос снят! Этот код будет работать. Всё сделали ещё до меня.
Google translate: The question is cleared! This code will work. Everything was done before me. :)
One video
Two video

ccrause:

--- Quote from: Seenkao on April 21, 2021, 04:05:00 pm ---и микроконтроллер обработает его без ошибок.  :) У меня просто нет ни чего, для проверки кода... :(
google translate: and the microcontroller will process it without error. :) I just don't have anything to test the code ... :(

--- End quote ---
If you want to test code you can try a simulator such as simavr or fp-avrsim (fp-avrsim is a Pascal translation of the core simulator of simavr, thus it may be easier to compile for someone used to FPC/Lazarus).  Simavr does have more peripheral support such as IO ports, SPI, I2C, timers etc. With both of these you can debug your AVR program inside Lazarus.

Qemu also has support for AVR but I haven't tested that yet.

Navigation

[0] Message Index

Go to full version