thegoodfellas/blogset-br huggingface dataset:
eu queria dividir com voce. Eu tenho medo de te assustar. Me controlo tanto quando voce esta perto... Mas hoje, Lindo, e a ultima vez que eu vou passar horas sofrendo por voce. Acabei de decidir, olha so que coisa boa. Porque e verdade, me apaixonei pela primeira vez e nao fui correspondida pela primeira vez, mas as pessoas vivem sobrevivendo a esse tipo de coisa. Eu mesma ja me levantei dos buracos mais escuros e voltei a caminhar. Se eu estiver enganada e voce simplesmente for timido demais pra sempre aproximar, esse risco fica por sua conta, porque nao esperarei mais um sorriso seu pra ir embora. Assim como tambem nao ficarei mais chateada por voce nao ter se despedido na sexta-feira e eu ter que esperar ate segunda pra descobrir se voce estava me evitando ou so com pressa. Nao odiarei mais as meninas que te cercam e conseguem conversar com voce enquanto eu so falo com os outros, tentando chegar perto. Da pra viver em funcao de alguem que nem ao menos demonstra preocupacao comigo? Nao, nao da.Hoje decidi te esquecer, mas amanha vou te ver. Ah, esquece esse texto todo. Deixa so eu olhar pra voce, sem respirar, sem falar, sem me mover. Acho que esse e o relacionamento mais humano que eu ja tive: So eu sinto, so eu sofro, so eu acho que existe.Veronica H.
Nao adianta chegar numa festa cheia de barulho e gente e querer conversar, achando que antes do cara sugar um pouquinho da minha alma, deve saber que eu nao sou umas dessas mulheres vazias, sem uma alma para ser sugada. Tem mais que vento dentro de mim, mas isso e meu. Nao faz diferenca eu agir como uma pessoa superficial e querer explicar pra todo mundo que eu nao sou. Sempre me arrependo de sair, ir a lugares que nao tem nada a ver comigo. Mas eu tenho essa necessidade futil de ser vista. Quando eu me escondo em casa, me sinto anulada. Preciso da opiniao dos outros, de elogios. Quando alguem mostra que se lembrou de mim, adoro. Se diz que sentiu minha falta, tenho mais motivos pra sorrir. Quem precisa saber? Por que e que eu me importo com quem nao me conhece?Veronica H. Hi! In this post Ill try to show you how to use a Character LCD. A Character LCD (only LCD from now on, on this post) is a nice way of outputing information for the user. Evidently... So, almost all LCDs have the same controller, the HD44780. Its datasheet is here LINK (along some others for the lcd module itself, you can find others on the internet). Read it before continuing. If you look at table 6 at page 24/25 of the datasheet, youll see the patterns of commands it accepts. One observation here is that it gives the times the instructions takes to happen. Its better to wait some fixed time after the instruction than to try checking the busy flag. Realy. Another one is that theres two modes: 8bits and 4bits. The 8bits mode use 8 paralelal lines to send the command while the 4bits mode use only 4 lines, a series of two half commands. Its better to use the 4bits modes since it uses less pins from the MCU. In the datasheet, there are exemples of how the modes should work, so you just need to study them to understand how to control them.The characters on the LCD occupies a position, line x and columm y, or, more tecnicaly, a position in the LCD memory, which distributes like this for a 20x4 lcd:Notice that the memory position increments, but the end of line 1 increments to the beginning of line 3, while the end of line 2 increments to the beginning of line 4, and the two lines (1/3 and 2/4 don't connect, the end of a line increments to the beginning of itself, you can see this when we learn to use the 16 key keyboard, on the next post =P ).Well, that's the basic. Here's our exemple. We use a 20x4 LCD.The code for it is here LINK, try to understand the macros and the sequences of commands.In a next post I'll show how to make it easier to write words.Edit:Sorry, I forgot to say something about the pratical side.Well, if you have a char lcd, then you should look for it's datasheet and see what are the pins. I
my case, a JHD204A, the pins are:VSS is ground and VCC is ~+5V. VEE does not need to be connected, but it theoreticaly controls the contrast. LED- can be ground and LED+, the ~+5V, they control the brightness of the backlight led. The other pins are the control pins and data pins, no need to explain.Must also be noted that almost all char lcd works the same way.Also, I'm adding here a table with the instructions for the lcd control.
Anyone who finds English errors in this blog can support us by making a comment about the error and we'll fix it. English is not our official language.Help us on this please, so that we can improve this blog. As promissed.The key idea, since you alread know how to put individual chars, is that you can make a "table" of chars, a string, using the data directive and than read it in sequence. Each byte read will be a char and so you put it on the lcd, one at a time, till the end of the string... you get the idea.It's important to define how to know when the string ended. In my case i choosed to end each string with a null byte, the char "\0", and check for it.Notice that you should write the string on the program like I did, in some reserved part, and not in the middle of the main program before using the macro. As an exercise, figure why.So, I'll just update the files from the past exemple, check the new code there: LINK.Till next time with the 16-key Keyboard. Ok, sorry for the delay, i got sick But let us continue. In my previous post, I gave a brief example of an assembly program to make a led switch on/off periodicaly, but i left somethings for you to figure out. First: Macros. Macros are like functions of an structured language, but they serve not the program but the compiler. Generaly you declare a macro to use instead of a larger piece of code that you constantly use, like the movlf macro: The pic18 assembly does not offer a direct function to put a literal on a register, so, i use this macro. I declare it: movlf macro literal, file, a movlw literal movwf file, a endm then, instead of using two lines of code to do what i want, i use justo ne: movlf .45, 0x002, ACCESS for instance. But more usefull is when the piece of code differs a little bit in each use. As the macro accepts arguments like a function, and its processed by the assembler, it can make your life easier. Lets see the delay macro exemple. First, how does it work? A delay can be done using the timers of the pic, or using the instructions to make a counter and a loop. Using the second method seems to be more economic. It works like this: count till you reach X, when you do, proceed. The greater the X, the longer the delay, ease enough. The pic18 offers to instructions we can use: decfsz and bra. We just need to know what the number X must be for a desired delay. But if the delay desired is very long, you can put a loop inside a loop, and then you need X and Y. Or it can be bigger still, and youll need to find X, Y and Z... and so on. The simplest of ways to find those values is using the MPLAB SIM. On the MPLAB, write
the code for the delay but use random parameters. Like: processor 18f4620 list x=OFF, r=dec #include movlf macro literal, file, a movlw literal movwf file, a endm cblock X, Y endc movlf .35, X, ACCESS movlf .23, Y, ACCESS nop decfsz X, f, ACCESS bra $+.4 decfsz Y, f, ACCESS bra $-.6 nop end Notice the movlf macro in use, and the two nop instructions, which simulates a constant delay that there may be (in my case, as i wrote the macro to work calling a routine, the time of the call and return), besides the constant delay of the assignment of values X and Y. This constant delay you have to calculate yourself, in this case its 5 cycles (in the case of my macro, its 7). Now, select the MPLAB SIM as the debugger, activate the stopwatch and put the breakpoints in place. Execute the program. ON the first stop, click on zero on the stopwatch and resume the execution, which will stop again at the second break point. Right, how many instruction cycles passed? Notice that the quantity of cycles is including the cycle for the first nop, so you should subtract one. Also notice that we use the cycle quantity and not the time value becouse the first one is Always the same while the second one varies acording to crystal and oscilator configurations. You can build a linear system and find the parameters: X Y Cycles 5 + 35 * B + 23 * C = 28339 5 + 35 * B + 45 * C = 56499 That gives us C = 1280 and B = 5. For a longer delay, its the same process. Check my macro, i did it up to 4 nested loops. Having B and C, you can calculate the necessary X and Y for a desired delay. And better still, you can write a macro for doing it for you, as i did. Notice my use of conditional sentences and calculations with integers. Its done so that i just need to specify the quantity of cycles or microseconds and it choses the adequate routine (quantity of loops) and the values. Finaly, here it is a picture of the working thing: And and quick tip: na easy way to get a decent power souce is modifing a cheap computer power souce, like this: Very ugly yet functional and cheap and easy to get working. =P And finaly, if you are having trouble making it work although it works on the simulations, maybe the problem is the brownout reset or the icsp configuration, so disabling the two of them may help a lot (it did with me).Till next time!
Today I'm going to talk about resistors... I believe it's the most basic of the basic components (pretty basic isn't it)Take a look at this video: http://www.youtube.com/watch?v=VPVoY1QROMgIt's another great video by Collin Cunningham =)Well, as he said resistors are used in almost any circuit...There are no brands for resistors... most of times they are just referred by their resistance value. Resistors also have some manufacturing error percentage, which means it can be a bit more or less the resistance it specifies... The most common are the %5 and %1. (I don't remember seeing other one). So a 100 ohms resistor with %5 maybe between 95 and 105 ohms. For common uses, it's not a concern, but some analog circuits need precision on their resistors.There is also the resistor's "power". This means, the max amount of power they can be connected to without any damage. So there are 1/8 W, 1/4 W, 1W, 2W, 3W, 5W, etc. So if you connect a 120 ohms 1/4 W resistor to a 9v battery, it'll produce a current of:I = v/R = 9/120 = 0.075 AThe amount of power on the resistor is:W = v*i = 9*0.075 = 0.675 WSo this 1/4W (0.25W) resistor is dissipating 0.675W which means it can burn out =)I already fried out a resistor while holding it in my fingers... it was a 120 ohms 1/4w resistor and I connected it to the 120v wall outlet, so it gave me 120 W =)I measured it's resistance after that, and it got like 2k ohms or something lol... this may be handy when you need a high resistance resistor and you do not have it xDBut don't try this at home, the smell is not good and damaged parts with unknown values may damage the entire circuit, and you lose $$$ =(See pictures of different resistors in Google images:http://www.google.com.br/images?hl=pt-br&biw=1680&bih=935&gbv=2&tbs=isch:1&sa=1&q=resistors&aq=f&aqi=&aql=&oq=Most of circuits using resistors can be divided in 2 "categories":1- It may be used as limiting current to power some device. Like LEDs need resistors to limit current... or when you see some electric heating system, some of them use a low resistance (like 5-50 ohms) to get the wire heated up. This can be electric water heating, or a soldering iron, etc. So you choose the proper resistor by the amount of power you need.2- Analog circuits use resistors, capacitors and inductors as "input data" for the desired output. For example, if you have a variable voltage regulator, which in one pin you have the voltage input (a 9v volt battery for example), and you have the regulated voltage output (to supply a 5v microcontroller with that 9v battery). There is another input that will determine the output voltage, and normally it's used with resistors. So in this case the resistor is chosen by the required resistance for you to have a proper design of your analog circuits.See this tutorial: http://www.sparkfun.com/tutorials/219 about limiting current with a resistor.There are a lot of analog circuits to do all sort of things, like amplifying a signal, regulate voltage, filtering a signal, create oscillation, etc, and
most of these circuits are designed with some math to find out the right values for its components (resistors, capacitors, etc).There won't be a lot of analog circuits in this blog, just enough to get your digital circuit connected to. There will be no guitar effect pedal for example... btw check this video: http://www.youtube.com/watch?v=_X0bL6WS-VY .There are a lot of things in this video that we didn't speak about yet, but basically what he is doing is getting the original controls of that distortion pedal (a potentiometer) and changing it with a digital potentiometer. Analog circuits are really powerful for sound applications.Wikipedia:"A potentiometer (colloquially known as a "pot") is a three-terminal resistor with a sliding contact that forms an adjustable voltage divider. If only two terminals are used (one side and the wiper), it acts as a variable resistor or rheostat. Potentiometers are commonly used to control electrical devices such as volume controls on audio equipment. Potentiometers operated by a mechanism can be used as position transducers, for example, in a joystick."Wikipedia makes this a lot easy :pSo when you have a circuit that needs to get as input a desired value from the user (like volume, brightness, speed, etc), one way to get this input is with a potentiometer. The schematic symbol for potentiometer is this:Or this:CABAnd they look like this: This is a slide potentiometer:This is the one used for those slide sound controllers for djs or sound equipments.You can have knobs to put on them so they look a little better. These are knobs:So you see common knobs and a slide knob =)The potentiometers are referred by their resistance value between terminals A and B of the 2nd schematic picture. They are also referred as "linear" or "logarithmic" potentiometers and this refers to "the way they change their resistance". We will only use linear potentiometers in this blog which have resistance proportional to the potentiometer position. If you want to know more about potentiometers you can check wikipedia for that, at: http://en.wikipedia.org/wiki/Potentiometer .One of the most useful things to make using only resistors is a voltage divider. Take a look at this tutorial: http://www.sparkfun.com/tutorials/207So for example, we have a 5V signal and we want to make it a 3.3V signal:The math is:Vout = Vin*R2/(R1+R2)3.3 = 5*R2/(R1+R2)2/3 = R2/(R1+R2) -> 3*R2 = 2*R1+2*R2 -> R2 =2*R1So that means R2's resistance needs to be 2 times R1's resistance. So if you use a 100 ohms resistor in R1 you need to use a 200 ohms resistor in R2.Well, that's easy and handy, but no one has resistors of all values at home to use in circuits. So we can use a combination of resistors so we can find the resistance we want. We can connect resistors in "series" or in "parallel". Take a look at this photo: So if we add resistors in series we just add their resistance. It's not very useful to add them in parallel (I never needed to) but connecting them in series is really useful. On the voltage divider example we needed a resistance R1 and R2
where R2 is 2 times R1. So we can get 3 resistors, and use one of them as R1 and connect the other two resistors in series so that they together will be the R2. This is handy because resistors are really cheap and usually they are sold in packs of 5, 10 or more. So you probably gonna have 3 or more of the same value.This is a voltage divider calculator: http://www.raltron.com/cust/tools/voltage_divider.aspWe can use potentiometer as a voltage divider too:So there is the resistor between terminals A and B, and this W terminal which is connected to the wiper we move. So this works as a voltage divider as the resistance between the wiper and the A terminal works as R1 and the resistance between the wiper and B terminal works as R2. Connecting A to +5v and B to GND or 0V, as we turn the wiper the voltage changes proportional to its position. Voltage increases as we turn the wiper to A terminal and decreases as we turn it to B terminal (if we connect B to + and A to - that would be the opposite situation).So it's easy to measure this output voltage from the potentiometer using a microcontroller for example. But to use a potentiometer on analog circuits, it may be required to use it as a variable resistance and not a variable voltage as it is if we connect A to + and B to - (or the opposite), instead we would connect A (or B), as one terminal, and the W terminal as the other terminal, and that gives us a variable resistance that increases when we get near A (or B).This is the same thing as a slide potentiometer.I saw a nice video about EMF (electromagnetic field) detector. Take a look at it: http://www.youtube.com/watch?v=y1Bke3750WESo it's Collin again. The basic idea is that the EMF in the place affects the wire which he connected to his microcontroller, and by reading the voltage on that pin he can control an LED to have brightness proportional to the voltage reading. He connects a 3.3 Mohms resistor from the wire to ground. That works a bit like a voltage divider. Take a look at the photo:So in this case R1 is the voltage between an electric device like a computer, or a lamp, or anything, to that piece of wire connected to the microcontroller, and R2 is the 3.3 Mohms (3.3 *1000000 ohms) resistor. Remember the first Collin's video about resistor, he showed how to make the LED's brightness increase and decrease as he passes the connection by the graphite that's because any material has its resistance. So in the EMF detector video, when Collin goes near a device the R1 decreases which means "Vin" increases. Although it's EMF and not a common voltage, the example can illustrate a little bit what's going on. The R2 resistor is being used to "filter" a little bit so that the EMF detector is less sensitive. If we use a smaller resistance it gets less sensitive so the light start
to bright a bit more close to the device we are getting near.Edit (02/14/2011): I forgot to speak about something important. There are some sensors that work as variable resistors. There are gas sensors, microphones, LDR (light dependent resistor), etc. So this type of devices have a "resistor" inside them, that changes based on the "amount" of what they are sensing. A gas sensor for example will get a lower resistance if we have a bigger concentration of gas in the place. A LDR will have a smaller resistance in a lighted room. So that's how they work, and in order to measure this variable resistance, we need to make a voltage divider circuit. So when the sensor's resistance gets smaller, the voltage output is higher. If we using a microcontroller or something, we can measure this value with a simple calculation on the program and perform some action like move a robot, turn on a LED, show the value on a LCD or something like that. This devices are great for analog circuits because this simple variable resistance can be used with no problem in a analog circuit, what would be not so easy if we were using a digital sensor which "sends a message" with the value of what it's sensing. We will talk about some of these devices later as we move on to microcontrollers. So I believe this is everything about resistors. I may add something that I did not mentioned, but I believe I talked about all the useful topics. I may add things to the topic if I remember it.So, next time I'll talk about capacitors I think, as I never needed to use them a lot too, I probably won't talk a lot about them.I'll try to make a post about basic names and basic prototype things that you may need to start using real electronics. Till there feel free to try proteus, it's great to try some circuits without needing to make a real circuit or even having the require components. Proteus is not good if you need some more advanced things like GSM modules or GPS modules or things like that, but can do almost everything from the analog world and a lot of things from the digital world. So it's good to have it on your machine... try search for it on torrent.cya.
In this post I'll talk about Servos.What is a servo? It is an electric motor with some gears and a control circuit, whose position you can control, within a certain amplitude. Here i'll use a RC Servo, this one: LINK.This is a nice post about RC Servos (very nice images): LINK.The electric motor, in this case a DC motor, is what gives the thing the ability to actually move. But generally these motors are weak, that is to say they give you little torque. Torque is force times distance, Wikipedia: LINK. But they are fast, they rotate fast. That is where the gears comes in action. Power is equal to torque times angular speed. So, the gears diminish the angular speed and increases the torque of the output, Wikipedia: LINK.The ability to move alone can't do much. If you want position control, you need to know where you are. This is usually done with a potentiometer connected to the output shaft of the gearbox. Its resistance, and therefore the voltage level seem by the controller will be proportional to the actual angular position of the output shaft.Having the ability to move and the position feedback leaves you needing only a control algorithm that will tell the motor to move the output shaft to the desired position. As this is the complex part, I'll make a post about it in the future.So, basically, the servo has these three ingredients. To use one, you need only to power it and tell it the desired position. So, how do you command it?To command a RC Servo you send it a PWM signal, whose duty cycle is proportional to the position you want (the difference between a analog and a digital servo is that the later has a much higher frequency of the input pwm.PWM stands for Pulse Width Modulation, Wikipedia: LINK. It's a digital signal (it has high or low value) that takes the form of a train of pulses, with a determined period and a duty cycle, that is the percentage of the period in which the signal is high.In the case of our rc analog servo, the period is around 20ms (which gives us a 50Hz frequency), with a useful duty cycle between 525 us and 2325us, more or less ( a pulse of 525us would give a 0 angular position on the output shaft whereas one of 2325us, a 180, with values between these two would give a proportional angular position. You can play with these values to see what is the better combination.So, the program for this post simply consists of generating this PWM signal using the timer0 and two buttons to increase or decrease the position.As you can see in the code, it is made to control only one servo, but can easily be modified to control more servos (see the ~70 instruction cycles delay, that can be partially substituted by code to check for the pulse duration of others servos). One thing to note is that the duty cycle resolution that the servo sees is around 5us, but the
(in my case) amplitude of the duty cycle is near 2ms, so i need to correctly check the timing of the duty cycle control algorithm to give the result that i want.And a detail for the Proteus simulation. It's "motor-pwmservo" is controlled by a duty cycle between 1ms and 2ms.Also, another thing about the Proteus simulation. I just noticed i had not configured the frequency of the pic18 to 40mhz. It's 20mMhz there. When I tried to change to 40Mhz, the LCD stopped working :S . Well, I couldn't fix it, but what matters is that in the real life it works.There is a video for the working thing here: LINK. Again, sorry for the poor quality.The files are here: LINK.One word about the so called full rotation servos: they in fact offer speed control, not position. But of course, we are here talking about hobby servos. Industrial level ones are much more precise and robust. See this servo controller for a robust modification of a hobby servo: LINK.