Menu

Inspiration from Youtube video "Small basic!"

Winch
2022-02-18
2022-04-03
<< < 1 2 3 (Page 3 of 3)
  • Winch

    Winch - 2022-03-05

    Oké

     
  • Anobium

    Anobium - 2022-03-05

    These files tell me you have selected a Mega328p at 16 mHz on that software.

    But, you chose #chip mega32u4, 16 for Great Cow BASIC

    If the target chip is a Mega328p then used #chip mega328p 16 in Great Cow BASIC

     
  • Winch

    Winch - 2022-03-05

    sorry my mistake I sent you the wrong file!

     
  • Winch

    Winch - 2022-03-05

    For the uno I had created the same file as test.

     
    • Anobium

      Anobium - 2022-03-05

      I can see the error. These files really help. The USART is not being initialised correctly for this specific chip. This is easily resolvable but it will require some patience by you. The cause is that this chip may have one of the chips that Hugh tested many years ago, or, when we implemented hardware USART support is was not on the list of chips to be tested.

      Anyway.... we can add our own initialisation routine to resolve. This routine may not resolve first go. Once it does work we can move into the USART library. If this fails and you simply want to get going ... change to using Software Serial communications method.

      Use the following code - this is intended to only support transmit. It will take more work to resolve receive.

      ' ----- Configuration
      'Make into a comment to use the AVR chipset
      #chip mega32u4, 16     'Arduino UNO
      #option Explicit
      
        'USART settings
        #define USART_BAUD_RATE 9600
        #define USART_TX_BLOCKING
      
          ' Set the usart transmit registers here.
          ' exact baud rate achieved = 9615.38461; bit period = 104µs; baud rate error = 0.16%
          UBRR1L = 0xCF
          UBRR1H = 0x00
          UCSR1A = 0x42
          UCSR1C = 0x06
          UCSR1B = 0x18
      
          #DEFINE TXEN TXEN1
          #DEFINE UDRE UDRE1 
      
          dir PORTC.7 out
          HSerPrint "Small BASIC Responder"
      
          repeat 10
      
              PORTC.7 = ! PORTC.7
              wait 50 ms
      
          end Repeat
      
          dim MyString as string
      
          Do Forever
      
              'HSerGetString MyString, 1
      
              If MyString = "pin0=on" Then
              Set PORTC.7 On
              End If
              If MyString = "pin0=off" Then
              Set PORTC.7 Off
              End If
      
      
          Loop
      
       

      Last edit: Anobium 2022-03-05
  • Winch

    Winch - 2022-03-06

    Oké
    So if I understand correctly this should be modified in GCB?
    But until then I can use the code below to continue.
    I'm going to try this out this week. In any case, I'm glad to hear that we know what's going on and where the problem is coming from.

     
  • Winch

    Winch - 2022-04-01

    Hi I'm back.
    Not been able to work much on the project in recent weeks. Today I went further.
    I've tried the code you showed me before, but it doesn't work.
    I'm also wondering if this code wouldn't conflict with the compiler now built into GCB?

     
    • Anobium

      Anobium - 2022-04-01

      Post the project in a ZIP. the Small BASIC source and the Great Cow BASIC program.

      I can look for you.

       
  • Winch

    Winch - 2022-04-01

    Here are the files.
    Thanks

     
  • Anobium

    Anobium - 2022-04-01

    I think I need one of the board here. I ported to an UNO and it worked - of course.

    Willing to send me one?

    I am cannot sort the UART library without one. I am guessing on what is happening. I am guessing that the library is not setting some bit somewhere.

     
  • Winch

    Winch - 2022-04-01

    You mean send an arduino leonardo to you. I can do that.
    If that helps to a permanent solution. Would you like to send or email me the address?

     
    • Anobium

      Anobium - 2022-04-01

      I have sent you a personal message with my details.

       
  • Winch

    Winch - 2022-04-01

    Questions?
    I don't use the bootloader myself because I program the ATmega32U4 directly with my Atmel-ICE programmer.
    In other words: do you want to receive the board with or without the Arduino bootloader?

     
    • Anobium

      Anobium - 2022-04-01

      It would be best with a bootloader for speed at this end. But, I can program most MCUs. :-)

       
  • Winch

    Winch - 2022-04-01

    Okay then I'll give the Leonardo back its bootloader again.

     
  • Winch

    Winch - 2022-04-01

    I sent you an email earlier. Did you receive it?

     
  • Winch

    Winch - 2022-04-01

    Just to make sure you got it

     
    • Anobium

      Anobium - 2022-04-01

      Yes. I responded. Load the bootloader please

       
    • Anobium

      Anobium - 2022-04-02

      Try this please. Does this HEX work ?

       
  • Winch

    Winch - 2022-04-03

    Oké So this seems to work fine!
    Obviously I don't know what you did? But it seems to be the right solution.

     
    • Anobium

      Anobium - 2022-04-03

      I changed the Great Cow Basic USART library. But, since making the change I have discussed with the Developer of OshenSoft and I think I need to handle this chip differently. So, I still need the board.

      The issue is. Most AVRs have a USART0, in Great Cow BASIC we would call this Number #1. But, this chip does not have a USART0 but is starts with USART1. So, we discussed last night and I will align with the same convention where GCB will have to use USART2 not USART (which implies USART1). The change I made was a test to prove that this is just a library issue.

      So, we know it works. This this is just about writing the library and testing.

      Evan

       
<< < 1 2 3 (Page 3 of 3)

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.