Recent

Author Topic: Arduino zero level.  (Read 224 times)

Seenkao

  • Full Member
  • ***
  • Posts: 151
Arduino zero level.
« on: April 21, 2021, 03:04:30 pm »
Всем привет! Зная, что 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  [Select][+][-]
  1. program main;
  2.  
  3. procedure setup;
  4. begin
  5. end;
  6.  
  7. procedure loop;
  8. begin
  9. end;
  10.  
  11. begin
  12.   setup;
  13.   while true do
  14.     loop;
  15. end.
  16.  

ccrause

  • Sr. Member
  • ****
  • Posts: 371
Re: Arduino zero level.
« Reply #1 on: April 21, 2021, 03:29:52 pm »
Yes. Since it is valid Pascal it will work.

Seenkao

  • Full Member
  • ***
  • Posts: 151
Re: Arduino zero level.
« Reply #2 on: April 21, 2021, 04:05:00 pm »
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  [Select][+][-]
  1. .text
  2. .org 0x0000
  3. jmp main
  4.  
  5. main:
  6.         rcall setup
  7.         rcall loop
  8.         ret
  9.  
  10. setup:
  11.         ret
  12.  
  13. loop:
  14.         ret
  15.  
  16. .end
и микроконтроллер обработает его без ошибок.  :) У меня просто нет ни чего, для проверки кода... :(
google translate: and the microcontroller will process it without error. :) I just don't have anything to test the code ... :(

Seenkao

  • Full Member
  • ***
  • Posts: 151
Re: Arduino zero level.
« Reply #3 on: April 21, 2021, 04:43:25 pm »
Вопрос снят! Этот код будет работать. Всё сделали ещё до меня.
Google translate: The question is cleared! This code will work. Everything was done before me. :)
One video
Two video

ccrause

  • Sr. Member
  • ****
  • Posts: 371
Re: Arduino zero level.
« Reply #4 on: April 21, 2021, 06:59:42 pm »
и микроконтроллер обработает его без ошибок.  :) У меня просто нет ни чего, для проверки кода... :(
google translate: and the microcontroller will process it without error. :) I just don't have anything to test the code ... :(
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.

 

TinyPortal © 2005-2018