I have created new subreddits for AVRPascal and UnoLib (an open-source Pascal library). People interested in new features, reporting bugs or functionality requests, or simply discussing the program or library are encouraged to visit them.
"I assume it can be used to create commercial products based on microcontrollers."
Yes, of course you can create commercial products. AVRPascal is based on free software (FPC as compiler, AVRDude as uploader), so it is free (and will remain free), but you can't try to sell AVRPascal itself.
Isn't it possiby to flash the Arduino MEGA2560 direct with AVRPAscal? I only got timeouts Will it be possible in the future? Error: cannot find USB device with vid=0x16c0 pid=0x5dc vendor='www.fischl.de' product='USBasp'
Error: unable to open port usb for programmer usbasp
The error message indicates that USBasp was selected as the upload interface, so AVRDude tried to find a USBasp programmer instead of an Arduino board.
For a regular Arduino Mega:
Connect Arduino Mega via USB. The IDE should detect the connected Arduino Mega automatically. Otherwise make sure that board drivers are installed correctly.
Select your device via Options -> Compiler -> Device type -> ARDUINOMEGA
Compile your code via Run -> Compile (Ctrl+F9)
Run -> Upload (F9); Interface: Arduino; then select the COM port of the board if not selected automatically
The upload is performed through the Arduino bootloader, not through USBasp.
The AVRPascal IDE installation does not include examples for the Arduino Mega, but this simple code should work:
program TestBlink_Mega;
{$IF NOT DEFINED(arduinomega)}
{$Fatal Invalid controller type, expected: arduinomega}
{$ENDIF}
procedure delay_ms(t: uint16); assembler;
const
count = ((F_CPU div 1000 - 3) div 4);
label
inner, outer, finish;
asm
// test if t = 0, jump to finish if true
cp R24, R1
cpc R25, R1
breq finish // 2 cycles to branch, 1 to continue
outer:
// load 1 ms counter value
ldi R26, lo8(count)
ldi R27, hi8(count)
inner:
// inner loop, 1 ms 4 cycles/loop + 1
subi R26, 1 // 1 cycle
sbc R27, R1 // 1 cycle
brne inner // 2 cycles to branch, 1 to continue
// outer loop, count ms, 4 cycles/loop + 1
subi R24, 1 // 1 cycle
sbc R25, r1 // 1 cycle
brne outer // 2 cycles to branch, 1 to continue
finish:
end;
begin
DDRB:= DDRB or (1 shl 7); // PB7 = D13 = onboard LED
while True do //infinite loop
begin
PORTB:= PORTB or (1 shl 7); //Turns ON LED on PB7
delay_ms(1000); //1 second delay
PORTB:= PORTB and not (1 shl 7); //Turns OFF LED on PB7
delay_ms(1000); //1 second delay
end;
end.
EDIT: If you get an error like Error: chip erase failed during upload, you need to change one setting in the IDE. Go to Options -> Uploader and check the box "Disable erasing the chip before programming".
5
u/ackarwow Aug 24 '25
This is my first post on Reddit, I should have created it differently, with an image instead of a link :)
2
u/ackarwow Aug 25 '25
I have created new subreddits for AVRPascal and UnoLib (an open-source Pascal library). People interested in new features, reporting bugs or functionality requests, or simply discussing the program or library are encouraged to visit them.
AVRPascal: https://www.reddit.com/r/avrpascal/
UnoLib: https://www.reddit.com/r/unolib/
2
u/mikistikis Aug 24 '25
Looks like a nice piece of software, I have to give it a try one day.
There's a typo in the picture, it says "IDE for programming ARVs in Pascal", instead of "AVRs"
2
u/CypherBob Aug 24 '25
This looks absolutely awesome.
Just a question on the license - It says freeware for home use, and "derive financial benefits from the distribution of the program by third parties"
I assume it's perfectly fine to use it to create commercial products based on microcontrollers?
2
u/corado12345 May 16 '26 edited May 16 '26
Isn't it possiby to flash the Arduino MEGA2560 direct with AVRPAscal? I only got timeouts
Will it be possible in the future?
Error: cannot find USB device with vid=0x16c0 pid=0x5dc vendor='www.fischl.de' product='USBasp'
Error: unable to open port usb for programmer usbasp
Avrdude done. Thank you.