Now I will start to present my ideas and project about build a home CNC (or engraver?)
I define it bringing the reality of parts more easyly avaliable here, in my city and country; I live in inner city in southen Brasil; a little different from USA and Europe, where is easy to find allthings; here is hard to find some kinds of parts; so I am adapting as possible the parts, as all others, to build my CNC; also I have tiny space to build everything.
I have in mind build all the electronic hardware.
Also I want to use other aproach for the software e and IOlines to control the motors; want to use bipolar motors; homopolar are too noise. Yet, the use of parallel port are to much exausted by all others CNC builings; I want to bring some new. Soon as possible I will post all the specs. I just like to note I preetend make a nice speed control to CNC.
I define all the project and now starting to cut the parts in 1.5 cm MDF;
Also should mention I will use IGUS parts, due to easy that its offer to build this kind of project; We have a good regional reseller for this parts. I already buy its and soon will post the IGUS's photos; I have its since a year ago, but dont have spare time to build the entire system. until now.
Bellow the image of I hope to become the CNC.
The 2 axis XZ are fixed and Y work above X (or Z).
Soon a post more about the project.
Sorry my poor english, but I not a good english writer.
I want to put all the software here too.
If you have some suggestio, please, dont think twice.
tell me! ;) I will appreciate!
Wednesday, December 30, 2009
Monday, December 28, 2009
The Fix of Manchester decoding routine code from Michochip (keeloq) - Tb 045
Manchester decoding receive routines from michochip datasheet (presented for keeloq system) is a great and easy way to start work with remote control systems. The first part of this fix are in here.
The document TB045 of microchip offer code for everyone that own microchip controllers to use, and guide to the basics to Manchester decoding , through the implementation of a state machine.
I implement and test a system, based in code of TB045.
Also, implement the Manchester transmitter code, and it is enough simple.
Beyond basic systems to transceiver serial data, believe that Manchester encoding allow robust data reception, and is very stable.
However, after implement the system, the transmitter and receive, I discover that not work at all so well. Let me explain what I do..
I build the transmitter code, that is very stable and precise (interrupt based).
Also, use 2 segment display to show data being received on receiver side, with pic.
I know what data was being transmitted (by transmiter ). I check with my "ociloscope audiocard" and, all times the data are transmitted nicely (the waveform are just perfect).
So I use a typical transmitter/receiver 'made in china' to transmit and receiver the data over the air.
However, the problems begin.
Each ~10 transmitted burst of data, the receiver don’t understand one sequence of transmited data. Upon 5%. (I am talking about a complete burst of data, with many bytes). Also other times it get the data, but very wrong.
I will show to you the pictures bellow that show the transmitted code and received one.
You can implement the native code over PIC (not over arduino, microchip not allow this by this terms) too and detect this.
The problem is that anyone that try use this code, due the small percentages of problems, never will take real care about; but the problem still is there.
Maybe commercial products has been release with this bug… that disallow the perfect opration of entire system….
So let’s start!
The first problem detected was the error in receiving nice code.
I look with oscilloscope (audiocard) the received code at pin of receiver, and everything seen correct. Even when receiver PIC decode the wrong data.
And also stay tune in what the PIC-receiver are saying about the received code.
But some times the PICs lost it self, and detect wrong data.
So I start investigate the keeloq receiver routine.
Since the sender routine is nice, and my code inserted into the receive routine really not interfere in the manchester decoding, I look in the interrupt driven routine of manchester decoding routine.
But before, let me explain how I debug!
The manchester decoding routine use four (4) main state machine. State 0 to 3. Look to TB045 to learn more.
So I just insert inside each one of these states BCF and BSF instruction, to set and reset unused PIC pin.
Now I know exactly where the “pic” is running during the tests and more important, during the errors.
Using the two channel audio card I get the data and the behavior of state machine.
Bellow you see the CODE of debugged version.
After analyze code and states througt the pin that say for me the actual state, when the error occurred, I found the flow problems.
The system detects the preamble as valid signal and start to sampling data. Preamble is a sequence of 0 and 1 send by transmitter used to stabilize the receiver before start to synchronize and send the data.
Almost always 0xFF 0xFx etc and some other wrong data are received in this cases, then the data are get wrong.
But why this thing happen?
The system would be nice, and the preamble would guarantee that everything is working fine.
It was possible to detect through debug data lines that the state 2 are starting just right in preamble start. Much stranger!
But this happen sporadic.
So I go to the code try find what are happening.
I look just before the execution of state 2, in state 1, who start state 2. Bellow the code.
See the original code: (page 6 / 7)
;----------------------------------------------------------------------
; State 1
; Waiting and measuring a Synch Header
TRFSync
btfsc RFIN ; wait for a rising edge
goto TRFRise
incf RFsamp,F ; while input low count the samples
movf RFsamp,W
btfsc STATUS,Z
goto TRFReset ; check overflows (this should not happen)
incf RFSkip,F ; skip = 1
goto AsyncRFE ; remain in state 0
When the TRFReset happen, because of RFsmaple overflow, the RFsamlpe are reset to 0.
Whoever, it should not be reseted. It should stay in a high value. Think with me: during no transmission, the signal is always 0. So RFsample stay running and counting higher and higher. But if an overflow happens, (256), the RFsample is reset to 0, and start count again. If it count until 4 te, (sync), and the preamble comes soon, the machine detect as a valid sync signal, and start to sample! As the RFsamble is reseted every 255 cycles, is likely to this happen. So to fix this problem, we just maintain the counter of RFsample higher if it passes the maximum size of allowed counts. Prefer higher than constant LONG_HEAD; but bellow 255, so if not happen any preamble to force a reset, the system never get out this state, and no cause lost in data in! Ta ta! Bellow the fixed version.
. . .
;----------------------------------------------------------------------
; State 1
; Waiting and measuring a Synch Header
;
TRFSync
;bsf LED_STATUS0
;movlw 0x1
;movwf display
btfsc RFIN ; wait for a rising edge
goto TRFRise
incf RFsamp,F ; while input low count the samples
movf RFsamp,W
btfsc STATUS,Z
goto TRFCorrige ; we create a new way to code follow; If it go here, mean that a long time pass and no more valid sync will happen
;goto TRFReset ; check overflows (we eliminate this)
incf RFSkip,F ; skip = 1
goto AsyncRFE ; remain in state 0
TRFCorrige
movlw 0xf0 ; we set the “border” almost in the limit, just to make sure that never will accept any code before the first bit of preamble
movwf RFsamp ; and move to RFsample
incf RFSkip,F ; skip = 1
goto AsyncRFE ; remain in state 0
TRFRise
. . .
This force the code to stay waiting for preamble, and first bit in preamble reset the counter throught TRFRise, where is the right place for TFRReset to be called.
After this change, the receiver routine no more shows the wrong behavior.
TRFFull ; received them all
movlw TRFReset ; next state will be Reset
movwf RFState
bsf RF_Full ; set the buffer full flag
goto AsyncRFE ; done
I smart look can reveal the problem. The variable RFState must contain just a value between 0 and 3; but here, we are assigning a pointer to memory position of TRFReset to it. And this is always a enigma data; that might be 0, may be 1, ou 10 or 60 or any pointer.
TRFFull ; received them all
movlw 0x0 ; the state, not he memory position
; movlw TRFReset ; next state will be Reset (wrong)
movwf RFState
bsf RF_Full ; set the buffer full flag
goto AsyncRFE ; done
I think that is a simple but nice help for anyone that think in use this code.
I have the fixed version of this code; but above you can copy and paste and use the code without fear.
However I don’t responsabilyze about any problem that this fix can cause!
By now, just rest to say that I appreciate you opinion about the article.
The document TB045 of microchip offer code for everyone that own microchip controllers to use, and guide to the basics to Manchester decoding , through the implementation of a state machine.
I implement and test a system, based in code of TB045.
Also, implement the Manchester transmitter code, and it is enough simple.
Beyond basic systems to transceiver serial data, believe that Manchester encoding allow robust data reception, and is very stable.
However, after implement the system, the transmitter and receive, I discover that not work at all so well. Let me explain what I do..
I build the transmitter code, that is very stable and precise (interrupt based).
Also, use 2 segment display to show data being received on receiver side, with pic.
I know what data was being transmitted (by transmiter ). I check with my "ociloscope audiocard" and, all times the data are transmitted nicely (the waveform are just perfect).
So I use a typical transmitter/receiver 'made in china' to transmit and receiver the data over the air.
However, the problems begin.
Each ~10 transmitted burst of data, the receiver don’t understand one sequence of transmited data. Upon 5%. (I am talking about a complete burst of data, with many bytes). Also other times it get the data, but very wrong.
I will show to you the pictures bellow that show the transmitted code and received one.
You can implement the native code over PIC (not over arduino, microchip not allow this by this terms) too and detect this.
The problem is that anyone that try use this code, due the small percentages of problems, never will take real care about; but the problem still is there.
Maybe commercial products has been release with this bug… that disallow the perfect opration of entire system….
So let’s start!
The first problem detected was the error in receiving nice code.
I look with oscilloscope (audiocard) the received code at pin of receiver, and everything seen correct. Even when receiver PIC decode the wrong data.
And also stay tune in what the PIC-receiver are saying about the received code.
But some times the PICs lost it self, and detect wrong data.
So I start investigate the keeloq receiver routine.
Since the sender routine is nice, and my code inserted into the receive routine really not interfere in the manchester decoding, I look in the interrupt driven routine of manchester decoding routine.
But before, let me explain how I debug!
The manchester decoding routine use four (4) main state machine. State 0 to 3. Look to TB045 to learn more.
So I just insert inside each one of these states BCF and BSF instruction, to set and reset unused PIC pin.
Now I know exactly where the “pic” is running during the tests and more important, during the errors.
Using the two channel audio card I get the data and the behavior of state machine.
Bellow you see the CODE of debugged version.
After analyze code and states througt the pin that say for me the actual state, when the error occurred, I found the flow problems.
The system detects the preamble as valid signal and start to sampling data. Preamble is a sequence of 0 and 1 send by transmitter used to stabilize the receiver before start to synchronize and send the data.
Almost always 0xFF 0xFx etc and some other wrong data are received in this cases, then the data are get wrong.
But why this thing happen?
The system would be nice, and the preamble would guarantee that everything is working fine.
It was possible to detect through debug data lines that the state 2 are starting just right in preamble start. Much stranger!
But this happen sporadic.
So I go to the code try find what are happening.
I look just before the execution of state 2, in state 1, who start state 2. Bellow the code.
See the original code: (page 6 / 7)
;----------------------------------------------------------------------
; State 1
; Waiting and measuring a Synch Header
TRFSync
btfsc RFIN ; wait for a rising edge
goto TRFRise
incf RFsamp,F ; while input low count the samples
movf RFsamp,W
btfsc STATUS,Z
goto TRFReset ; check overflows (this should not happen)
incf RFSkip,F ; skip = 1
goto AsyncRFE ; remain in state 0
When the TRFReset happen, because of RFsmaple overflow, the RFsamlpe are reset to 0.
Whoever, it should not be reseted. It should stay in a high value. Think with me: during no transmission, the signal is always 0. So RFsample stay running and counting higher and higher. But if an overflow happens, (256), the RFsample is reset to 0, and start count again. If it count until 4 te, (sync), and the preamble comes soon, the machine detect as a valid sync signal, and start to sample! As the RFsamble is reseted every 255 cycles, is likely to this happen. So to fix this problem, we just maintain the counter of RFsample higher if it passes the maximum size of allowed counts. Prefer higher than constant LONG_HEAD; but bellow 255, so if not happen any preamble to force a reset, the system never get out this state, and no cause lost in data in! Ta ta! Bellow the fixed version.
. . .
;----------------------------------------------------------------------
; State 1
; Waiting and measuring a Synch Header
;
TRFSync
;bsf LED_STATUS0
;movlw 0x1
;movwf display
btfsc RFIN ; wait for a rising edge
goto TRFRise
incf RFsamp,F ; while input low count the samples
movf RFsamp,W
btfsc STATUS,Z
goto TRFCorrige ; we create a new way to code follow; If it go here, mean that a long time pass and no more valid sync will happen
;goto TRFReset ; check overflows (we eliminate this)
incf RFSkip,F ; skip = 1
goto AsyncRFE ; remain in state 0
TRFCorrige
movlw 0xf0 ; we set the “border” almost in the limit, just to make sure that never will accept any code before the first bit of preamble
movwf RFsamp ; and move to RFsample
incf RFSkip,F ; skip = 1
goto AsyncRFE ; remain in state 0
TRFRise
. . .
This force the code to stay waiting for preamble, and first bit in preamble reset the counter throught TRFRise, where is the right place for TFRReset to be called.
After this change, the receiver routine no more shows the wrong behavior.
Looking deeply I found that the routine in state 3, TRFFull have a error too: see bellow:
TRFFull ; received them all
movlw TRFReset ; next state will be Reset
movwf RFState
bsf RF_Full ; set the buffer full flag
goto AsyncRFE ; done
I smart look can reveal the problem. The variable RFState must contain just a value between 0 and 3; but here, we are assigning a pointer to memory position of TRFReset to it. And this is always a enigma data; that might be 0, may be 1, ou 10 or 60 or any pointer.
Fixed version is:
movlw 0x0 ; the state, not he memory position
; movlw TRFReset ; next state will be Reset (wrong)
movwf RFState
bsf RF_Full ; set the buffer full flag
goto AsyncRFE ; done
I think that is a simple but nice help for anyone that think in use this code.
I have the fixed version of this code; but above you can copy and paste and use the code without fear.
However I don’t responsabilyze about any problem that this fix can cause!
By now, just rest to say that I appreciate you opinion about the article.
Thursday, September 17, 2009
Argumentação através da Intimidação
Isso está sendo muito utilizado nas empresas na atualidade.
Vale a pena ler.
Lembra-me aquele ditado.
Manda quem pode, obedece quem tem "juizo" (medo).
http://akitaonrails.com/2009/09/12/off-topic-a-argumenta--o-atrav-s-da-intimida--o
Vale a pena ler.
Lembra-me aquele ditado.
Manda quem pode, obedece quem tem "juizo" (medo).
http://akitaonrails.com/2009/09/12/off-topic-a-argumenta--o-atrav-s-da-intimida--o
Saturday, June 13, 2009
TI Verde x Terror Verde - o que é realmente verde?
Tenho deparado com noticias de todos os lados sobre o novo "hipe" da industria de TI.
A TI Verde
Mas é realmente verde? Será que muitos não estão entendendo mal isto e tomando atitudes que nao são verdes?
Uma premissa da TI verde que muitos falam e acredito precisar de uma analize maior é sobre a virtualização de servidores.
A moda agora é virtualizar tudo. Pessoalmente, acredito que é para economizar em equipamentos!? Só pode ser, pois virtualizando se está logicamente consumindo MUITO MAIS KW de energia da maquina em que funciona a VM para marter os varios computadores funcionando:
Boa parte do processamento é repetido nas varias VMs consumindo energia desnecessariamente.
Isso é verde?
Seria mais interessante que os fabricantes fizessem hardwares mais facilmente reciclaveis (desmotanveis) no final de sua vida, e que recolhessem os mesmos. Isso sim seria verde. Nao atitudes exdruxulas de marketing sobre um assunto serio como o lixo e consumo desenfreado de recursos. Veja que clustes são exelentes, mas VMs são o inverso. Montar um baita cluster e sobre ele um monte de VMs. Muito controverso no minimo.
Essa discução no forum da cwconnect.computerworld.com.br ajuda a refletir um pouco sobre esse assunto.
Tambem como citam, trocar o CRT pelo LCD ajuda a consumir menos energia, mas o lixo que o monitor representa no ambiente é milhares de vezes pior;
TERROR VERDE como é lá citado.
Tambem o tempo de vida de um monitor LCD é de 5 anos em media (10000 horas).
Meu monitor que fica ligado 8 horas por dia, não vai duraria 5 anos. Ainda estou com um CRT.
Ta ai um bom trabalho para conclusao de algum curso. Avaliar se as medidas de TI verde sao realmente verdes.
A TI Verde
Mas é realmente verde? Será que muitos não estão entendendo mal isto e tomando atitudes que nao são verdes?
Uma premissa da TI verde que muitos falam e acredito precisar de uma analize maior é sobre a virtualização de servidores.
A moda agora é virtualizar tudo. Pessoalmente, acredito que é para economizar em equipamentos!? Só pode ser, pois virtualizando se está logicamente consumindo MUITO MAIS KW de energia da maquina em que funciona a VM para marter os varios computadores funcionando:
Boa parte do processamento é repetido nas varias VMs consumindo energia desnecessariamente.
Isso é verde?
Seria mais interessante que os fabricantes fizessem hardwares mais facilmente reciclaveis (desmotanveis) no final de sua vida, e que recolhessem os mesmos. Isso sim seria verde. Nao atitudes exdruxulas de marketing sobre um assunto serio como o lixo e consumo desenfreado de recursos. Veja que clustes são exelentes, mas VMs são o inverso. Montar um baita cluster e sobre ele um monte de VMs. Muito controverso no minimo.
Essa discução no forum da cwconnect.computerworld.com.br ajuda a refletir um pouco sobre esse assunto.
Tambem como citam, trocar o CRT pelo LCD ajuda a consumir menos energia, mas o lixo que o monitor representa no ambiente é milhares de vezes pior;
TERROR VERDE como é lá citado.
Tambem o tempo de vida de um monitor LCD é de 5 anos em media (10000 horas).
Meu monitor que fica ligado 8 horas por dia, não vai duraria 5 anos. Ainda estou com um CRT.
Ta ai um bom trabalho para conclusao de algum curso. Avaliar se as medidas de TI verde sao realmente verdes.
Tuesday, May 05, 2009
Lixo eletronico
Documentario no Youtube, a respeito do lixo eletronico que estamos gerando, e o destino de boa parte dele. A triste realidade, não apenas dos chineses que reciclam este lixo, mas tambem nossa que não tem capacidade de dar um fim mais digo.
http://www.youtube.com/watch?v=ZHTWRYXy2gE
O que vamos fazer com isso tudo?
Os designers devem começar a pensar em soluções que sejam facilmente separaveis e reciclaveis, e que não utilizem muitos produtos da linha vermelha.
Já penso mais vezes antes de trocar meu computador, ou monitor, não apenas pela questão financeira, mas pela questão ambiental.
Todos deveriamos lembrar disto antes de consumir bens eletronicos de forma desenfreada.
Tanta inteligencia, "tecnologia" e não temos produtos que ao menos sejam facilmente separaveis e reciclaveis.
http://www.youtube.com/watch?v=ZHTWRYXy2gE
O que vamos fazer com isso tudo?
Os designers devem começar a pensar em soluções que sejam facilmente separaveis e reciclaveis, e que não utilizem muitos produtos da linha vermelha.
Já penso mais vezes antes de trocar meu computador, ou monitor, não apenas pela questão financeira, mas pela questão ambiental.
Todos deveriamos lembrar disto antes de consumir bens eletronicos de forma desenfreada.
Tanta inteligencia, "tecnologia" e não temos produtos que ao menos sejam facilmente separaveis e reciclaveis.
Subscribe to:
Posts (Atom)