you need to update the i2cslave package.
↧
BASCOM-AVR : Compiler-Error in BASCOM 2078 : REPLY
↧
BASCOM-AVR : I remember some issue with the AVRISPII and larger page Mega : REPLY
attached the latest dat file.
preserve your old file because this is actual a 2080 file.
↧
↧
BASCOM-AVR : I remember some issue with the AVRISPII and larger page Mega : REPLY
Thanks Mark. I assume I wasn't too far off about a paging error?
And as you say to keep the original .def file I'm curious as to why?
↧
BASCOM-AVR : Compiler-Error in BASCOM 2078 : REPLY
Thanks for the hint, Marc!
I have the I2CSLAVE.lib registered.
How can I sign on the side http://register.mcselec.com/prodreglist.php
a I2CSlave update received?
Do I have to buy it again?
Is there a howto?
↧
BASCOM-AVR : Compiler-Error in BASCOM 2078 : REPLY
when you have it registered and it is validated, you can simply download it from register.mcselec.com
just login and click 'download lic files'
then look for : Download full I2CSLAVE Lib and click the download button.
↧
↧
BASCOM-AVR : I remember some issue with the AVRISPII and larger page Mega : REPLY
[quote:fbe6dbf3ce]Thanks Mark. I assume I wasn't too far off about a paging error? [/quote:fbe6dbf3ce]
I dont know, i did not check it, i only uploaded the last version. So you need to check if that version solves your problem.
[quote:fbe6dbf3ce]And as you say to keep the original .def file I'm curious as to why?[/quote:fbe6dbf3ce]
because :
- it is always a good idea to keep a version you overwrite
- this new dat file is from 2080 and it might make your code not compile. might, dont say it does.
↧
BASCOM-AVR : SIM800L GPRS GSM Module : REPLY
Hello everyone!
Where's wrong with this program, I tried more than once, but does not work
[code:1:b19498dc7f]
$regfile = "m8def.dat"
$crystal = 3686400
$baud = 9600
$hwstack = 64
$swstack = 64
$framesize = 64
Config Portb.0 = Output
Config Portb.1 = Output
Config Portb.2 = Output
Config Portb.3 = Output
Config Portb.4 = Output
Config Portb.5 = Output
Declare Sub Getline
Declare Sub Send_sms
Declare Sub Sms_check
Relay1 Alias Portb.5
Relay2 Alias Portb.4
Relay3 Alias Portb.3
Relay4 Alias Portb.2
Rled Alias Portb.0
Gled Alias Portb.1
####################################
Dim Status1 As Eram Byte At 5
Dim Status2 As Eram Byte At 6
Dim Status3 As Eram Byte At 7
Dim Status4 As Eram Byte At 8
Dim Number As Eram String * 13 At 10
'------------ Variables and constants for GSM --------------------------------- ------
Dim Num As String * 80
Dim Msg As String * 160
Dim Inmsg As String * 160
Dim Gstmp As Byte
Dim Ar(10) As String * 20
Dim Sender As String * 25
Dim Engine As Byte
Dim Alarms As Byte
Dim Icnt As Byte
Dim A_armed As Byte
Dim Gps As Byte
Dim Stmp As Byte
Dim Pass_stored As String * 13
'Print Pass_stored
Relay1 = 0
Relay2 = 0
Relay3 = 0
Relay4 = 0
Pass_stored = Number
Gps = Status1
If Gps = 0 Then
Relay1 = 0
Else
Relay1 = 1
End If
Gps = Status2
If Gps = 0 Then
Relay2 = 0
Else
Relay2 = 1
End If
Gps = Status3
If Gps = 0 Then
Relay3 = 0
Else
Relay3 = 1
End If
Gps = Status4
If Gps = 0 Then
Relay4 = 0
Else
Relay4 = 1
End If
Wait 1
Rled = 1
Gled = 0
Wait 20 ' give some time for gsm modem
' give some time for gsm modem
Print "AT"
Wait 2
Print "AT+CMGD=1"
Wait 2
Print "AT+CREG?"
Wait 2
Print "ATE0"
Wait 2
Print "AT+CNMI=1,1,0,0,0" 'new message indication off
Wait 2 'Third command TEXT MODE
Print "AT+CMGF=1"
Wait 2
'Print #2 , "AT+CSQ" 'signal strength
'Wait 2
Rled = 0
Gled = 1
Do
Print "AT"
Wait 2
Print "AT+CMGF=1" ' Change to text mode Wait 2
Print "AT+CMGR=1" ' get the message
Getline
If Inmsg <> "OK" Then
Rled = 1
Gled = 1
Num = Inmsg
Getline
Gps = Split(num , Ar(1) , ",")
Num = Ar(2)
Gps = Len(num)
Gps = Gps - 2
Num = Mid(num , 2 , Gps)
Inmsg = Lcase(inmsg)
' Print Num ; "Msg:" ; Inmsg
If Inmsg = "microcontroller" Then 'other numbers
Pass_stored = Num
Number = Pass_stored
Msg = "Password Accepted"
Send_sms
Elseif Num = Pass_stored Then
If Inmsg = "light on" Then
Relay1 = 1
Status1 = 1
Num = Pass_stored
Msg = "Light Switched ON"
Send_sms
Elseif Inmsg = "light off" Then
Relay1 = 0
Status1 = 0
Num = Pass_stored
Msg = "Light Switched OFF"
Send_sms
Elseif Inmsg = "fan on" Then
Relay2 = 1
Status2 = 1
Num = Pass_stored
Msg = "Fan Switched ON"
Send_sms
Elseif Inmsg = "fan off" Then
Relay2 = 0
Status2 = 0
Num = Pass_stored
Msg = "Fan Switched OFF"
Send_sms
Elseif Inmsg = "ac on" Then
Relay3 = 1
Status3 = 1
Num = Pass_stored
Msg = "AC Switched ON"
Send_sms
Elseif Inmsg = "ac off" Then
Relay3 = 0
Status3 = 0
Num = Pass_stored
Msg = "AC Switched OFF"
Send_sms
Elseif Inmsg = "tv on" Then
Relay4 = 1
Status4 = 1
Num = Pass_stored
Msg = "AC Switched ON"
Send_sms
Elseif Inmsg = "tv off" Then
Relay4 = 0
Status4 = 0
Num = Pass_stored
Msg = "AC Switched OFF"
Send_sms
Else
Num = Pass_stored
Msg = "Invalid Command.."
Send_sms
End If
End If
Wait 2
Print "AT+CMGD=1"
Wait 3
Rled = 0
Gled = 1
End If
Gled = 0
Waitms 1
Gled = 1
Wait 8
Gled = 0
Waitms 1
Gled = 1
Loop
'@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
' SEND SMS
'@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Sub Send_sms
Rled = 1
Wait 3
Print "AT+CMGS=" ; Chr(34) ; Num ; Chr(34) 'send sms
Waitms 200
Print Msg ; Chr(26)
Wait 5
Print "AT"
Wait 2
Rled = 0
End Sub
'@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
' Read gsm modem
'@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Sub Getline
Inmsg = ""
Do
Gps = Inkey()
If Gps > 0 Then
Select Case Gps
Case 13 : If Inmsg <> "" Then Exit Do ' if we have received something
Case 10 : If Inmsg <> "" Then Exit Do ' if we have received something
Case Else
Inmsg = Inmsg + Chr(gps) ' build string
End Select
End If
Loop
End Sub
End [/code:1:b19498dc7f]
↧
Various : ODB11 Scan Tool : NEWTOPIC
For those like me who have cars with computers and are ODB11 type
A scan tool for less than AU $20
I have one it works!
I can not even see how it could be sold for the price the case and plug would cost that much!
Search Ebay for "Autel Maxiscan MS300"
Has MCP2515 can controller with a TJA1050 High speed CAN transceiver and a 90C53RC micro
Even if you just want a ready made cable to play with ODB11
Regards Paul
↧
BASCOM-AVR : Compiler-Error in BASCOM 2078 : REPLY
Thank you for the answer, Marc.
On the "Product Register Side" i can see my
registered and validated Products, but there is
only a Button to update BASCOM,
no Button to update my registered product "I2CSLAVE Lib"
what can i do?
↧
↧
BASCOM-AVR : Compiler-Error in BASCOM 2078 : REPLY
you did not register properly. i fixed it for you. refresh the page and try again.
↧
Share your working BASCOM-AVR code here : Matrix math routines : REPLY
Hello Meister,
Regarding the trick of shifting a SINGLE variable. I will post a separate contribution here where I show its use in a routine for
running average of a stream of floating point variables.
So check that post when it comes in.
Comments are as always invited.
Especially you can give a thought about WHY it works...
About your polynome fitting.
I'll come back on it when I have read it through more carefully
Regards
Per
↧
BASCOM-AVR : soft spi : NEWTOPIC
hi
how can we set DATA_ORDER = LSB|MSB , POLARITY = HIGH|LOW , PHASE = 0|1 & CLOCKRATE = 4|16|64|128 in soft spi?
[b:c59ef2367c][color=red:c59ef2367c](BASCOM-AVR version : 2.0.7.8 )[/b:c59ef2367c][/color:c59ef2367c]
↧
Share your working BASCOM-AVR code here : Moving average for INTEGER and SINGLE data streams : NEWTOPIC
RUNAVG:
This post demonstrates an extremely efficient algorithm for smoothing of real time data.
It is based on a recursive mechanism that I have shown here before, but here it comes in two versions
One for signed Integer data and one for single floating point data.
The method is interesting for three reasons:
1. It works "in line" so there is no need for storing data. It consumes very little RAM. Just a 32bit accumulator
2. It is very fast as no division is involved. only shifting.
3. The floating point version called RUNAVG_SING is also very fast as it too use shifting rather than division
It is not obvious that dividing a FP-number by 2^N works by simply shifting. But it does...
Check these three lines. They are the essence of the algo.
[size=9:b407757a31] Runavg_sing = Sum
Shift Runavg_sing , Right , Factor , Signed 'compute data average from accumulated values
Sum = Sum - Runavg_sing 'subtract the old average
Sum = Sum + Newval 'add the new value
[/size:b407757a31]
Both routines can be found in their respective testprograms called RUNAVG.BAs and RUNAVG_SING.BAS
You can run then in any avr-processor. I have tested them in an Arduino mega 1280.
Running in the Bascom internal compiler also works fine.
I hope you find these routines useful. I use them all the time.
Comments and improvements invited.
/Per
↧
↧
BASCOM-AVR : soft spi : REPLY
DATA_ORDER, you can change it only when also using the mode option, see help file.
POLARITY and PHASE you can change with the MODE option, see help file.
CLOCKRATE you can change a sort of with the SPEED option, see help file.
http://avrhelp.mcselec.com/config_spi.htm
Don't know for what you need it, but SHIFTIN and SHIFTOUT can also be an option.
↧
BASCOM-AVR : Compiler-Error in BASCOM 2078 : REPLY
Marc, many thanks ... now the update is working correctly!
-entry completed-
↧
BASCOM-AVR : SIM800L GPRS GSM Module : REPLY
just an ide
'we use a serial input buffer
Config Serialin = Buffered , Size = 40 '
'enable the interrupts because the serial input buffer works interrupts driven
Enable Interrupts
↧
BASCOM-AVR : SIM800L GPRS GSM Module : REPLY
Hello dasha,
Where can i get this mini gsm modem?
Thanks
Best regards
toto
↧
↧
BASCOM-AVR : SIM800L GPRS GSM Module : REPLY
Ebay
↧
Share your working BASCOM-AVR code here : Moving average for INTEGER and SINGLE data streams : REPLY
Hi Per,
I am using your moving average in Bascom like this:
I was not able to use a function (I hardly understand Bascom function behaviour':x')
[code:1:b59b891637]Accum2 = Temperature_accumulator2
Shift Accum2 , Right , Sm2 , Signed 'Accumulator sum divided by 2^moothing factor
Temperature_average2 = Accum2 'returnvalue
Temperature_accumulator2 = Temperature_accumulator2 - Accum2 'Subtract old value
Temperature_accumulator2 = Temperature_accumulator2 + Ma_smooth
Ma_smooth = Temperature_average2
'Ma_smooth is continously updated.[/code:1:b59b891637]
The routine seems to do what is should. However, I am not sure if that yields the same result as your function construct due the question of passing the variables.
[code:1:b59b891637]Declare Function Temperature_average(temperature_accumulator As Long , Temperature_new_val As Word , Byval Smooth_factor As Byte) As Integer
'Your function definition[/code:1:b59b891637]
I also want to use it in a Java program. The compiler (IDE) is called B4J. There function values are always passed by value.
Will this do the same as the Bascom code?
[i:b59b891637] Sub movaverag( Temperature_new_val As Int , Smooth_factor As Byte) As Int
'Function Temperature_average(temperature_accumulator As Long , Temperature_new_val As Integer , Byval Smooth_factor As Byte) As Integer
Dim Accum1 As Long
Accum1 = Temperature_accumulator 'This is the old average on LONG form.
'Shift Accum1 , Right , Smooth_factor , Signed 'Accumulator sum divided by 2^moothing factor
Accum1=Accum1/Power(2,Smooth_factor)
Temperature_average = Accum1
Temperature_accumulator = Temperature_accumulator - Accum1 'Subtract old value
Temperature_accumulator = Temperature_accumulator + Temperature_new_val
Return Temperature_average
End Sub[/i:b59b891637]
Best regards, Meister
↧
Share your working BASCOM-AVR code here : Moving average for INTEGER and SINGLE data streams : REPLY
Hi Meister
Well, my java skills are rather limited but it looks quite ok to me the way you build the averaging function.
The mechanism is as follows:
1. Use an accumulator with enough width to hold the integer plus extra bits you loose when shifting.
2. Load the accumulator into a temporary variable of same length.
3. Right-Shift the number of steps you desire (e.g divide by 2^N) Be sure to obey the signbits when shifting so you dont shift in zeroes when accumulator was negative
4. Assign the above result to your output variable (Probably an integer) This is your new avarage
5. Add the new data from the input stream to your accumulator
6. Subtract the oldest data from the accumulator to compensate for this newly added (this is the "running" thing)
Step 6 is where you make the magic trick.
As you dont have the oldest indata value anymore (we dont save all data remember!), we have to use the most
recent average as a approximative substitute for the oldest indata.
In the long run this is a rather good guess, so the iteration always converge.
In steady state the accumulator utilization will be the size of your indata * 2^N
So you will not suffer from accumulator overflow as long as your average indata is less than accumulator_range/2^N
/Per
↧