Forum - MCS Electronics

 

FAQFAQ SearchSearch RegisterRegister Log inLog in

Arduino Uno not taking code
Goto page 1, 2  Next
 
Post new topic   Reply to topic    www.mcselec.com Forum Index -> BASCOM-ARDUINO
View previous topic :: View next topic  
Author Message
Neptune769

Bascom Member



Joined: 27 Jul 2008
Posts: 55

usa.gif
PostPosted: Sat Apr 30, 2016 2:31 am    Post subject: Arduino Uno not taking code Reply with quote

Hello Everyone,

I have been away for several years. I just found out that Bascom can be used on Arduino hardware. I copied some code to test. When I compile it, it is okay. However when I try to program the Arduino the TX & RX LEDs flash as if it is sending the program. But it doesn't work like it should. Can anyone tell me what the problem could be? I would appreciate any help. The code I wanted to test is below.

Thank you,

Dennis L.

Code:
$regfile = "m328pdef.dat"

$crystal = 16000000
Config Clockdiv = 1
Config Pinb.5 = Output

Do
Set Portb.5
Waitms 200
Reset Portb.5
Waitms 500
Loop

End
Back to top
View user's profile
bzijlstra

Bascom Ambassador



Joined: 30 Dec 2004
Posts: 1179
Location: Tilburg - Netherlands

netherlands.gif
PostPosted: Sat Apr 30, 2016 11:34 am    Post subject: Port... Reply with quote

Try config portb.5 = output
Back to top
View user's profile Visit poster's website
Neptune769

Bascom Member



Joined: 27 Jul 2008
Posts: 55

usa.gif
PostPosted: Sun May 01, 2016 5:54 pm    Post subject: Reply with quote

Thanks for the reply. However it still not working.
Back to top
View user's profile
bzijlstra

Bascom Ambassador



Joined: 30 Dec 2004
Posts: 1179
Location: Tilburg - Netherlands

netherlands.gif
PostPosted: Sun May 01, 2016 6:03 pm    Post subject: Stacks... Reply with quote

Where are the lines

Hwstack
Swstack
Framesize

Try it without the config clockdiv

There are two Arduino options to program, which one do you use and at what baudrate?

What Bascom-AVR version are you using?

JP Duval wrote a small instruction how to program the Arduinos.

Have fun
Ben Zijlstra
Back to top
View user's profile Visit poster's website
Neptune769

Bascom Member



Joined: 27 Jul 2008
Posts: 55

usa.gif
PostPosted: Sun May 01, 2016 6:24 pm    Post subject: Re: Stacks... Reply with quote

bzijlstra wrote:
Where are the lines

Hwstack
Swstack
Framesize

Try it without the config clockdiv

There are two Arduino options to program, which one do you use and at what baudrate?

What Bascom-AVR version are you using?

JP Duval wrote a small instruction how to program the Arduinos.

Have fun
Ben Zijlstra


Hi Ben,

I copied the code from the thread "getting started with Arduino and bascom" by Duval JP. The Hwstack, Swstack & Framesize were not in the code. I wouldn't know what numbers to enter for those.

I will try it without the config clockdiv.

I am using the USB port on the Arduino to program with Programmer set to Arduino with baud rate to 115200 as shown in the zip file from Duval JP.

I am using Bascom ver. 2.0.7.5

Thanks for your help.
Back to top
View user's profile
bzijlstra

Bascom Ambassador



Joined: 30 Dec 2004
Posts: 1179
Location: Tilburg - Netherlands

netherlands.gif
PostPosted: Sun May 01, 2016 9:10 pm    Post subject: add stacks... Reply with quote

Add

$hwstack = 40
$swstack = 40
$framesize = 40

Checked, the test led of the Arduino Uno is on Portb.5

If we can not fix it, it is time for JP Duval to have a look Cool

Have fun
Ben Zijlstra
Back to top
View user's profile Visit poster's website
Neptune769

Bascom Member



Joined: 27 Jul 2008
Posts: 55

usa.gif
PostPosted: Sun May 01, 2016 9:29 pm    Post subject: Re: add stacks... Reply with quote

bzijlstra wrote:
Add

$hwstack = 40
$swstack = 40
$framesize = 40

Checked, the test led of the Arduino Uno is on Portb.5

If we can not fix it, it is time for JP Duval to have a look Cool

Have fun
Ben Zijlstra


I added the three lines to the code. It is still not working. I appreciate the help. The code is below.
Code:


$regfile = "m328pdef.dat"
$hwstack = 40
$swstack = 40
$framesize = 40

$crystal = 16000000
'Config Clockdiv = 1
Config Portb.5 = Output

Do
Set Portb.5
Waitms 200
Reset Portb.5
Waitms 500
Loop

End
Back to top
View user's profile
Duval JP

Bascom Member



Joined: 22 Jun 2004
Posts: 827
Location: France

france.gif
PostPosted: Mon May 02, 2016 11:19 am    Post subject: Reply with quote

Ok
The test program I posted been tested, it works.
Have test you the blink example given by Arduino?

Have you tested the led electrically?
is it an official UNO? copies are not controlled, the led may be upside down?
the USB connection is the serial port, you can try "print" and test it with the terminal emulator
as below:


'-------------------------------------------------------------------------------
' ARDUINO-UNO V3.BAS
'
' (c) 1995-2011, MCS Electronics
' This is a sample file for the Mega328P based ARDUINO board
' Select Programmer 'ARDUINO' , 115200 baud and the proper COM port timeout 200
'-------------------------------------------------------------------------------

$regfile = "M328pdef.dat"
$crystal = 16000000
$hwstack = 128
$swstack = 64
$framesize = 128
$baud = 57600

' les config----------------------------------------------------------------------
Config Clockdiv = 1 'par défaut le M328 utilise une clock diviser par 8
Config Pinb.5 = Output
Do
Set Portb.5
Print "led = 1"
Wait 1
Reset Portb.5
Wait 1
Print "led = 0"
Loop

End 'end program
'---------------------------------

JP Wink
Back to top
View user's profile Visit poster's website
Neptune769

Bascom Member



Joined: 27 Jul 2008
Posts: 55

usa.gif
PostPosted: Mon May 02, 2016 11:19 pm    Post subject: Reply with quote

Duval JP wrote:
Ok
The test program I posted been tested, it works.
Have test you the blink example given by Arduino?

Have you tested the led electrically?
is it an official UNO? copies are not controlled, the led may be upside down?
the USB connection is the serial port, you can try "print" and test it with the terminal emulator
as below:



Hi Duval,
There is a program on the Uno that makes an LED fade on & off. That was done with the Arduino IDE so that When the above program is working I will see the difference. That works fine. I have tried it on 3 Unos 1 Official and two copies. They all do the same thing. The LED is good.
Back to top
View user's profile
Paulvk

Bascom Member



Joined: 28 Jul 2006
Posts: 1107
Location: SYDNEY

australia.gif
PostPosted: Tue May 03, 2016 10:36 am    Post subject: Reply with quote

Neptune769

Did you copy and paste Duval JP program

Does bascom show you your chip in the programming screen

Regards Paul
Back to top
View user's profile
aphawk

Bascom Member



Joined: 23 Jan 2010
Posts: 151
Location: Brazil

brazil.gif
PostPosted: Tue May 03, 2016 3:16 pm    Post subject: Reply with quote

I can confirm that Duval's program works ok.

I use AVRDUDE commands as a command line in Bascom's Programmer Configurations to write to Arduino Uno, for more than 2 years this works very well.

Paulo
Back to top
View user's profile
Neptune769

Bascom Member



Joined: 27 Jul 2008
Posts: 55

usa.gif
PostPosted: Wed May 04, 2016 12:52 am    Post subject: Reply with quote

Paulvk wrote:
Neptune769

Did you copy and paste Duval JP program

Does bascom show you your chip in the programming screen

Regards Paul


Hi Paul,

Yes I copy and pasted the code. Also the chip is listed in the Bascom Options under the Compiler, Chip tabs.
I attached a screen capture.

Thank you,
Back to top
View user's profile
Neptune769

Bascom Member



Joined: 27 Jul 2008
Posts: 55

usa.gif
PostPosted: Wed May 04, 2016 12:57 am    Post subject: Reply with quote

aphawk wrote:
I can confirm that Duval's program works ok.

I use AVRDUDE commands as a command line in Bascom's Programmer Configurations to write to Arduino Uno, for more than 2 years this works very well.

Paulo


aphawk,

Thanks for the info.
Back to top
View user's profile
Paulvk

Bascom Member



Joined: 28 Jul 2006
Posts: 1107
Location: SYDNEY

australia.gif
PostPosted: Wed May 04, 2016 10:07 am    Post subject: Reply with quote

Hello Neptune769

No not that screen
The bascom program chip screen (F4) on key board

Regards Paul
Back to top
View user's profile
Duval JP

Bascom Member



Joined: 22 Jun 2004
Posts: 827
Location: France

france.gif
PostPosted: Wed May 04, 2016 6:27 pm    Post subject: Reply with quote

I dont understand because this programm works with Win XP, WIN7, win10
did you look where your arduino is connected : com?
JP Question
Back to top
View user's profile Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    www.mcselec.com Forum Index -> BASCOM-ARDUINO All times are GMT + 1 Hour
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum