Assignment error

Go To Last Post
8 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Dears,

I'm trying to implement an example dealing with timer1 and it's interrupt.

the is written by BASCOM-AVR but when i compile it i got the error showed in the attached photo

 

can I please know what that mean?

 

this is the code:

 

Dim New_time As Byte
Dim Temp As Byte
Dim Seconds As Byte
Dim Minutes As Byte
Dim Hours As Byte
Dim Key As Byte

Const True = 1
Const Reload = 62500

Config Timer1 = Timer , Prescale = 64
Ocr1ah = High(reload)                                                 'Output Compare RegisterA
Ocr1al = Low(reload)

Tccr1a = 0
Set Tccr1b.3                                                          'bit CTC1 of control register TCCR1B must be set.

Config Portb = Output
Portb = 255

On Compare1a Timer1_isr                                               'compare interrupt oc-curs.

Enable Compare1a
Enable Interrupts

Do
   Key = Pind
   If Key = &H7F Then
      Seconds = 0
      Minutes = 0
      Hours = 0
   End If
   While New_time = True
      If Seconds = 60 Then
         Seconds = 0
         Incr Minutes
      End If
      If Minutes = 60 Then
         Minutes = 0
         Incr Hours
      End If
      If Hours = 24 Then Hours = 0
      Temp = Makebcd(seconds)
      If Key = &HFE Then Temp = Makebcd(minutes)
      If Key = &HFD Then Temp = Makebcd(hours)
      Portb = Not Temp
      New_time = Not True
   Wend

Loop
End

Timer1_isr:
   New_time = True
   Incr Seconds
Return

 

Attachment(s): 

This topic has a solution.
Last Edited: Mon. Nov 18, 2019 - 08:01 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Are you sure the opposite of "True" is not simply "False"? (it is in most computer languages).

 

(in most languages "Not" would tend to imply binary not logical inversion).

 

EDIT: apologies I thought the language would have an inherent knowledge of Boolean but a quick check at:

 

https://avrhelp.mcselec.com/lang...

 

and also 

 

https://avrhelp.mcselec.com/func...

 

seems to suggest that is not the case and I see you simply define "True" as 1. If I were you then I would define "False" as 0 and then just switch the flag between True and False.

Last Edited: Mon. Nov 18, 2019 - 01:27 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Yes, i think i know what are you talking about, but the "true" is declared as a constant and "1" is put inside it.

so i thought with this instruction "not true" a "0" we will be in the result. which will be used in other variable.

This reply has been marked as the solution. 
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

i'm just thinking now what if also declared another constant "false=o", and used instead of "not true" statement

i think will be giving the same resault, am I right?

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Ayman89 wrote:

i'm just thinking now what if also declared another constant "false=o", and used instead of "not true" statement

i think will be giving the same resault, am I right?

clawson wrote:

EDIT: .... If I were you then I would define "False" as 0 and then just switch the flag between True and False.

SNAP ! :-)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

cool. thank you for taking the effort to reply me this fast.

can I actually contat you in person as I sometime needs some guidance in micro-controllers as i'm new to it.

it is will a much appreciated knowing there is a person to rely on :)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I'm always around here and the advantage of posting on Freaks is that if I'm not or you ask about something I'm not familiar with one of the many other regulars here might be able to help out instead. For example there are a number of Bascom users who reply here regularly (I only use Asm, C or C++).

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

i know i will keep asking in here

i just needed some expert's  guidance sto stay on the right bath 

any way if u don't have time for that thank for ur reply

have a good day sir