Quantcast
Channel: MCS Electronics Forum
Viewing all 20563 articles
Browse latest View live

BASCOM-AVR : 4D Systems Library : NEWTOPIC

$
0
0
Hello All. Has anyone noticed that there is a library for Arduino and Raspberry Pi but not for BASCOM-AVR environment. I have a uLCD43 PCT that I want to use it with an AVR-2560 in order to make an RTC. I have a library made ​​for this LCD to directly send it to LCD This works well, but now I do not use the graphics capabilities of this IC I would like to use the IDE from 4D-system to make a graphical interface and control it with Bascom-AVR code. Does anyone know more of it? -------------------------------------- Heeft iemand gemerkt dat er een bibliotheek is voor Arduino en Raspberry Pi maar niet voor Bascom-AVR omgeving. Ik heb een uLCD43-PCT die ik wil gebruiken met een AVR-2560 om daar een RTC mee te maken. Ik heb een bibliotheek gemaakt om direct deze lcd aan te sturen Dit werkt goed maar nu gebruik ik niet de grafische mogelijkheden van deze IC ik wil graag de IDE van 4D-system gebruiken om hiermee de grafische interface te maken en het aansturen met Bascom-AVR code. Weet iemand hier meer van af? Thanx [b:1bd71d9353][color=red:1bd71d9353](BASCOM-AVR version : 2.0.7.7 )[/b:1bd71d9353][/color:1bd71d9353]

Share your working BASCOM-AVR code here : Sorting Long variable type arrays : REPLY

$
0
0
thanks for sharing Paul. i also added long/dword sort to the mcs.lib. I kind of hoped users would add it. But nobody seems to need it. your code is universal and can be used on all data types.

Share your working BASCOM-AVR code here : NOKIA-3310/5110 LCD library : REPLY

Share your working BASCOM-AVR code here : Sorting Long variable type arrays : REPLY

$
0
0
Hello Mark I am going to sort time values in seconds with it. As always I am trying to make the code as small as I can, it started much larger then over time I put the maths into the brackets when I found I had it correct. You can if you want add it to Bascom help and or examples as as an example of insertion sort. Regards Paul

BASCOM-AVR : A Byte copy command similar to Mid? : NEWTOPIC

$
0
0
Hello all, I need to selectively copy some bytes from one variable to another. I tried MEMCOPY but that did not work. [code:1:d80f9d0f5c] 'bts = MEMCOPY(source, target , bytes[ , option]) ' w = MEMCOPY(Rxbuffer(NextStartPosition), Rx_Address(Rx_Addr_Cntr) , 2) ' w = MEMCOPY(Rxbuffer(NextStartPosition), Rx_Zone(Rx_Addr_Cntr) , 1) ' w = MEMCOPY(Rxbuffer(NextStartPosition), Rx_DevType(Rx_Addr_Cntr) , 1) ' w = MEMCOPY(Rxbuffer(NextStartPosition), Rx_DevType(Rx_Addr_Cntr) , 1) [/code:1:d80f9d0f5c] I also tried Mid, but the variables are not strings: [code:1:d80f9d0f5c] Rx_Address(Rx_Addr_Cntr) = Mid(Rxbuffer(NextStartPosition),2,2) Rx_Zone(Rx_Addr_Cntr) = Mid(Rxbuffer(NextStartPosition),4,1) Rx_DevType(Rx_Addr_Cntr) = Mid(Rxbuffer(NextStartPosition),6,1) [/code:1:d80f9d0f5c] Can anyone suggest the correct or best way to do this? Thanks, Tim [b:d80f9d0f5c][color=red:d80f9d0f5c](BASCOM-AVR version : 2.0.7.7 )[/b:d80f9d0f5c][/color:d80f9d0f5c]

BASCOM-AVR : A Byte copy command similar to Mid? : REPLY

$
0
0
Hello Tim I would overlay a byte array onto the variables then select the elements in the arrays to swap/move Regards paul

Share your working BASCOM-AVR code here : Sorting Long variable type arrays : REPLY

$
0
0
Also I tried Decr J instead of j = j - 1 but this required more bytes of flash Regards Paul

BASCOM-AVR : A Byte copy command similar to Mid? : REPLY

$
0
0
Hi Paul, Thanks for the tip. But it already is a bytes array: [code:1:e445549a86] Dim RxBuffer(253) As Byte [/code:1:e445549a86] Do you mean overlay a string like this: [code:1:e445549a86] Dim Rxstring As String * 253 At RxBuffer(1) Overlay [/code:1:e445549a86] Thanks again, Tim

BASCOM-AVR : A Byte copy command similar to Mid? : REPLY

$
0
0
Hello Tim then just copy the elements you want from buffer array to the other I thought with your question that they were not byte arrays just variables. regards Paul

BASCOM-AVR : A Byte copy command similar to Mid? : REPLY

$
0
0
[quote:4e60fe0ad2="TSEYFARTH"]I need to selectively copy some bytes from one variable to another. I tried MEMCOPY but that did not work. [code:1:4e60fe0ad2] w = MEMCOPY(Rxbuffer(NextStartPosition), Rx_Address(Rx_Addr_Cntr) , 2)[/code:1:4e60fe0ad2][/quote:4e60fe0ad2] Tim, I do not want to sound too harsh here, but I believe, that you do hard with programming, as you don't pay heed to advices, instead you make the same mistake over and over again. In this case it's the "I just post a chunk of code, which can't be simulated and lacks necessary info" mistake. And I think it's not only me, who did ask again and again for minimized samples usable for simulation. The memcopy-command exactly matches your requirement, and there's no need to mess around with strings or overlays. However, if there would be actually a bug in memcopy, how you you think, it can be found? Well, yes, by simulating the code. But for proper simulation, all variable dimensioning has to be known, to rule out a "bug made by user". So this minimum sample has to be created first, and there I wonder, why you, as the someone seeking for help, expect from the someone giving help to do your very work? Ok, preached enough... Here is a sample code: [code:1:4e60fe0ad2]' Bascom Ver 2.0.7.7 $Regfile = "m328def.dat" $Crystal=4000000 $hwstack=40 $swstack=16 $framesize=32 Dim BArr_A(16) As Byte Dim BArr_B(16) As Byte Dim Addr_A As Word Dim Addr_B As Word Dim rslt As Word BArr_A(1) = 10 BArr_A(2) = 66 BArr_A(3) = 5 BArr_A(4) = 128 BArr_A(5) = 13 Addr_A = 2 Addr_B = 5 rslt = Memcopy(BArr_A(Addr_A) , BArr_B(Addr_B) , 2) end[/code:1:4e60fe0ad2] If you simulate it (open the MEMORY window, select SRAM tab in simulator) by stepping the code with F8, you will notice array A's memory cells (in this sample at memory hex address 0100) are set and after, stepping over the memcopy command, you'll find the content of array A's cells 2 and 3 at position 5 & 6 of array B . That means, memcopy is working as expected and the reason it doesn't work for you, has to be found somewhere in your code.

BASCOM-AVR : 4D Systems Library : REPLY

$
0
0
Hello, maybe I spend a too much little time on 4D Systems site, but I read : "The 4DLCD-FT843 is a powerful SPI Display which enables a SPI host to be connected directly to the display, providing a powerful set of graphics features to the host using the on board FTDI FT800 Video Engine." and I see in this forum following the search engine : [url]http://www.mcselec.com/index2.php?option=com_forum&Itemid=59&page=viewtopic&t=12091&highlight=ft800[/url] and you can find some solution, let us know please . Again, to day, I can't loss to much time to search more. sorry. if it is not you answers. JP :wink:

BASCOM-AVR : A Byte copy command similar to Mid? : REPLY

$
0
0
Hi MWS. Yes, I am guilty as charged..... The medium gentility is sometimes a good idea - not preachy put downs, but a reminder of what can make a difference to the reader and the poster. The poster will get more responses with more complete information, as you have pointed out. I was actually going to make post today (just got up after a long night) that I was able to solve the problem. I was not getting the answer that I was expecting but was blind by the use of the MEMCOPY command. I had reviewed the help which was only a little help. Had the results been shown in the help for each of the lines of code that would have been more clarifying. And of course having not made a simple trial, as you suggested too, may have helped. This is the code that works properly [code:1:dd4c38f5f2] Dim RxBuffer(253) As Byte Dim Rxstring As String * 253 At RxBuffer(1) Overlay Dim RxBuff_Payload_Cntr As Byte Dim RxBuff_StrtPointer(30) As Byte Dim RxBuff_ByteCount(30) As Byte RxBuff_Payload_Cntr = 0 Dim RxBuffer_Full As Byte '1 = Yes, 0 = No RxBuffer_Full = 0 Dim Rx_Address(10) As word Dim Rx_strAddr As String * 40 At Rx_Address(1) Overlay Dim Rx_Zone(10) As Byte Dim Rx_strZone As String * 10 At Rx_Zone(1) Overlay Dim Rx_DevType(10) As Byte Dim Rx_strDevType As String * 10 At Rx_DevType(1) Overlay Dim Rx_Addr_Cntr As Byte Rx_Addr_Cntr = 0 ..... lots of other code..... If Rx_Addr_Cntr = 10 Then Rx_Addr_Cntr = 0 Incr Rx_Addr_Cntr 'bts = MEMCOPY(source, target , bytes[ , option]) w = MEMCOPY(Rxbuffer(NextStartPosition), b , 1) b = b *256 w = MEMCOPY(Rxbuffer(NextStartPosition + 1), Rx_Address(Rx_Addr_Cntr) , 1) Rx_Address(Rx_Addr_Cntr) = b + Rx_Address(Rx_Addr_Cntr) w = MEMCOPY(Rxbuffer(NextStartPosition + 2), Rx_Zone(Rx_Addr_Cntr) , 1) w = MEMCOPY(Rxbuffer(NextStartPosition + 4), Rx_DevType(Rx_Addr_Cntr) , 1) Print "Rx_Address(Rx_Addr_Cntr) ";Rx_Address(Rx_Addr_Cntr) Print "Rx_Zone(Rx_Addr_Cntr) "; Rx_Zone(Rx_Addr_Cntr) Print "Rx_DevType(Rx_Addr_Cntr) "; Rx_DevType(Rx_Addr_Cntr) [/code:1:dd4c38f5f2] Expected and received results are: Print "Rx_Address(Rx_Addr_Cntr) ";Rx_Address(Rx_Addr_Cntr) = 52719 Print "Rx_Zone(Rx_Addr_Cntr) "; Rx_Zone(Rx_Addr_Cntr) = 1 Print "Rx_DevType(Rx_Addr_Cntr) "; Rx_DevType(Rx_Addr_Cntr) = 1 In any case MWS, thanks for your response and reminder! Tim

BASCOM-AVR : A Byte copy command similar to Mid? : REPLY

$
0
0
[quote:fbbf3e48d4] I had reviewed the help which was only a little help.[/quote:fbbf3e48d4] Sure, the problem was the help. It was of no help. :shock: I just reviewed the help for memcopy but i do not understand how this can be confusing or be of little help? So something in the help did you think it was working different than you expected. What I wonder?

BASCOM-AVR : 4D Systems Library : REPLY

$
0
0
Thanx for the info, but I have already an 4Dsystem LCD that I will use for my project. Does anyone know if I can use an C++ written library in Bascom? In other words, Can I call an Library written in C++? This library exists on the website of 4D-Systems.

BASCOM-AVR : 4D Systems Library : REPLY

$
0
0
no you can not call a C++ library. I looked at that web but they have a lot of files/different stuff and i could not find it. you can better post a link to the file. I think i have seen bascom code for 4D chips before. In fact the LCD master Hkipnik posted on this forum most likely? http://www.youtube.com/watch?v=4OrmqeXyxPk http://bascom-forum.de/showthread.php?4588-4D-Systems-Display-%B5LCD-32PT-%28SGC%29-und-Bascom

BASCOM-AVR : 4D Systems Library : REPLY

$
0
0
This is the link where you can find a library written in C and for Raspberry pi http://www.4dsystems.com.au/product/uLCD_43PT_PI/

BASCOM-AVR : 4D Systems Library : REPLY

$
0
0
it seems like a simple serial lib. it should not be that hard to translate. for example: void bus_Out(WORD Bits) { unsigned char towrite[4] ; DWORD written ; towrite[0]= F_bus_Out >> 8 ; towrite[1]= F_bus_Out ; towrite[2]= Bits >> 8 ; towrite[3]= Bits ; WriteFile(ComHandle4D, &towrite[0], 4, &written, NULL) ; GetAck() ; } would become: sub bus_out(bits as word) printbin #1, f_bus_out ; bits getack end sub >>8 means shift 8 bits to the right so the first byte they send it the LSB. that is default in bascom when sending a variable. it seems like a nice display but bit expensive. i am busy to get FT800 finished so i have no time for it. but maybe already ported the code?

BASCOM-AVR : 4D Systems Library : REPLY

$
0
0
Mark Thanks for the info it like's not so difficult to make my own library now I see your example.

BASCOM-AVR : A Byte copy command similar to Mid? : REPLY

$
0
0
HI Mark, Please understand I am/was not throwing rocks at you or the tools you created - they ARE really GREAT! I cannot wait for the next tool set to become available - I will be one of the first to buy it! The problem was not with the help, and it was *of* help; but it would have been of even more help had it had just a tiny bit more. I will try to explain specifically what I mean. This is from the MEMCOPY in help. "/// option An optional numeric constant with one of the following values : 1 - only the source address will be increased after each copied byte 2 - only the target address will be increased after each copied byte 3 - both the source and target address will be increased after each copied byte "/// What is meant by "increased"?? Does this mean "changed to"? Or "incremented"? "/// Dim Ars(10) As Byte 'source bytes Dim Art(10) As Byte 'target bytes Dim J As Byte 'index For J = 1 To 10 'fill array Ars(j) = J Next J = Memcopy(ars(1) , Art(1) , 4) 'copy 4 bytes Print J ; " bytes copied" "/// what the new value of Art(1) Art(2) Art(3) Art(4) ? Is it the value 1, 2, 3, 4 or all 1's - I am 99% sure it is 1234. "/// Dim W As Word , L As Long W = 65511 J = Memcopy(w , L , 2) 'copy 2 bytes from word to long End "/// What is the new value of L? If the result was shown, ie what the new value of Art(1) Art(2) Art(3) Art(4) and L becomes, it would be clearer - at least to me. "/// For J = 1 To 10 Print Art(j) Next J = Memcopy(ars(1) , Art(1) , 10 , 2) 'assign them all with element 1 "/// In this case, when using option 2 how is the second array Art(1) set to the value of element 1? option 2 says that the target address (Art()) is "incremented", so how it is set to a 1 in each element of its array? If this is obvious to everyone else, please excuse my ignorance. And, perhaps this is deemed redundant, obvious or something else; but when fighting with a problem and one referrs to the help, which is what it is there for, the expected result is absolutely spelled out, leaving nothing to ambiguity. Having that absolute, would have said to me, that to look elsewhere in my code to find the problem. In the above cases, the two things that are confusing are the words "increased" in the options and in the last example understanding how they call get to a 1. Finally in this same help example, it says "MEMCOPY can also be used to clear an array quickly". How? After now having used this, I suppose I can assume that both the target and/or the source would be set to some new value like 255, or 0 etc. But spelling it out would complete the effort you made when you created and updated the Help. As a final example, from the help for MID: Dim S As String * 15 , Z As String * 15 S ="ABCDEFG" Z = Left(s , 5) Print Z 'ABCDE This spells out that the value of Z will be "ABCDE"! Leaving nothing to guess. Again Mark, I hope you do not take offense to the comments. In the above, you asked for a response and that is what I have tried to provide. Thank you, Tim

BASCOM-AVR : Timer resets after interrupt? : NEWTOPIC

$
0
0
Hi I'm experiencing unexpected behavior: When returning from an ISR, Timer1 resets to 0 and program flow jumps to the very top of the program, not back to where the ISR was triggered from. Then, the program executes one line of code (a Const ststement in my case, not nearly enough to overflow Timer1 again), then jumps right back to the ISR again! (As seen by the BASCOM simulator). Are both of these effects normal? I would have expected program flow to return to where it left and Timer1 to be what I set it at (plus a little) before it left the ISR (roughly 19050). Thanks for any help. Here is my code: [code:1:82d50a792b] 'Main Program ... Enable Interrupts 'Turn on global interrupt ability Enable TIMER1 On TIMER1 PL_tone_ISR Waitms 1000 '<-- Trigger timer1 overflow and ISR ... Do Loop End PL_tone_ISR: TIMER1 = 19000 If PLToneWavePosition = 3 Then 'Wave position varies from 0 to 3. At the top of the wave = 3 PLToneWaveDirection = Down '0 = a wave heading down, 1 = up PLToneWavePosition = 2 WalshBit1 = 1 WalshBit2 = 0 ElseIf PLToneWavePosition = 2 Then If PLToneWaveDirection = Down Then 'Moving from wave position 2 to 1 PLToneWavePosition = 1 WalshBit1 = 0 WalshBit2 = 1 Else 'Moving from 2 to 3 PLToneWavePosition = 3 WalshBit1 = 1 WalshBit2 = 1 End If End If Return '<-- Program execution returns from here to the very top of the file, processes 1 line, then jumps right back to the top of the ISR [/code:1:82d50a792b] [b:82d50a792b][color=red:82d50a792b](BASCOM-AVR version : 2.0.7.7 )[/b:82d50a792b][/color:82d50a792b]
Viewing all 20563 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>